4 ms·
How does React work under the hood. JavaScript would normally throw an error if it found <Map /> in the source code. How does React do this? Is it JS?
by _RPM 12y ago
How does React work under the hood. JavaScript would normally throw an error if it found <Map /> in the source code. How does React do this? Is it JS?
- hcarvalhoalves 12y agoThis is not React's, but a javascript preprocessor called JSX that compiles to JS (like LESS -> CSS). http://facebook.github.io/react/docs/jsx-in-depth.html http://facebook.github.io/react/docs/jsx-in-depth.html Something like <Map foo={bar}/> would compile to a function call Map({foo: bar}). Behind the scenes, React is not dealing with HTML. You can use React without JSX, but it's useful.
- _RPM 12y agoIs React a client-side framework, or server-side?
- mikewhy 12y agoboth; either
- baddox 12y agoIt's primarily client-side, but React components output a virtual representation of the DOM, so it's relatively simple to render a page on the server and return HTML.
- evan_ 12y agoGenerally you run the JSX pre-processor server-side and then everything else gets run client-side.
- vertex-four 12y agoIt's a client-side framework. You'll generally run the JSX preprocessor as part of your website's build process (i.e. before uploading it to a server).