3 ms·
> when I first saw the React syntax Do you mean JSX? Because "the React syntax" is just plain JS unless you're using JSX, is it not? IIRC even vdom nodes can b
by masklinn 12y ago
> when I first saw the React syntax
Do you mean JSX? Because "the React syntax" is just plain JS unless you're using JSX, is it not? IIRC even vdom nodes can be created by hand with literal objects.
- iLoch 12y agoYeah, JSX. Whoops!
- masklinn 12y agoYeah it's completely optional, facebook built it because they had built something similar previously and they like it, and I guess it may be simpler for "pure" designers used to HTML and stuff, but it's AOT-compiled to the corresponding JS calls and the mapping is fairly simple: <Component1 attr1="value1" attr2={foo}> <Component2/> <Component3/> </Component1> becomes (more or less) Component1( {attr1: "value", attr2: foo}, Component2(), Component3() );