Re:Vue.js: the good, the meh, and the ugly
by acemarke on Thursday July 05, 2018 @06:16PM
(#17467327)
Out of curiosity, what are you using instead of JSX? Plain `React.createElement()` calls, `createElement` aliased to a shorter variable like `e`, or something like the `react-hyperscript-helpers` library?
Re:Vue.js: the good, the meh, and the ugly
by DougBTX on Thursday July 05, 2018 @07:37PM
(#17467801)
We’re still using https://www.npmjs.com/package/react-dom-factories for plain DOM elements, so code looks like
dom.div({ props }, ...)
For our own components, we export the output of React.createFactory https://reactjs.org/docs/react-api.html#createfactory rather that the component itself, so rendering code looks like: MyComponent({ props }, ...)
I realise that both of those are marked legacy, with a nudge towards using JSX instead, but they are pretty thin wrappers around createElement so it seems like a small dependency.
Re:Vue.js: the good, the meh, and the ugly
by spiritcat on Thursday July 05, 2018 @06:52PM
(#17467543)
it's funny how originally jsx is what kept me away from react, and now it's what keeps me from leaving.
It's funny how everybody hated E4X when Adobe and Mozilla were doing it, and love JSX now.
Re:Vue.js: the good, the meh, and the ugly
by spiritcat on Friday July 06, 2018 @05:04AM
(#17469977)
I didn't even know this existed.
Re:Vue.js: the good, the meh, and the ugly
by interlocutor on Thursday July 05, 2018 @07:33PM
(#17467775)
You can actually leave react and still keep JSX. This tiny library lets you use JSX as a templating mechanism: https://github.com/wisercoder/uibuilder
> At which point, JSX is basically just another fancy HTML templating library.
JSX is optional syntax sugar; my team uses React and Redux heavily, but we've opted not to use it.
HTML templating is great actually, all the rendering is data -> UI.
If you go back to the early Rethinking Best Practices presentation[0], it boils down to asking why client side development isn't like like HTML templating. The answer is that updating the entire page DOM on every change is unworkable, there needs to be support for partial updates. That's what React offers, a return to the data -> UI paradigm, without having to write a secondary code path for partial updates.
[0] https://www.youtube.com/watch?v=x7cQ3mrcKaY