3 ms·
> explaining how JSX works is too confusing This is interesting; I take the opposite approach, thinking that if I can help someone understand that JSX is merel
by dceddia 6y ago
> explaining how JSX works is too confusing
This is interesting; I take the opposite approach, thinking that if I can help someone understand that JSX is merely fancy syntax on top of plain JS function calls, that React won't seem so "magical".
I sometimes see comments like "I hate React's looping syntax" and it's clear that a lot of people get hung up thinking about React as a templating language.
I can see how explaining that extra level of detail could be confusing though, especially right up front, and especially for developers who're simultaneously learning JS alongside React.
- frosted-flakes 6y agoI was reading through Crank.js's[1] documentation the other day, and I noticed that all of its examples explicitly set the JSX createElement function with a pragma comment. Like this: /** @jsx createElement */ import {createElement} from "@bikeshaving/crank"; import {renderer} from "@bikeshaving/crank/dom"; renderer.render(<div id="hello">Hello world</div>, document.body); [1]: https://crank.js.org/guides/getting-started https://crank.js.org/guides/getting-started