react-jsx Flashcards
1
Q
What is JSX?
A
A syntax extension to JS. Recommended use is with React to describe what UI should look like. It produces React “elements”. Gives you al the stuff that JS does plus more. It always compiles to actual JavaScript before running.
2
Q
Why must the React object be imported when authoring JSX in a module?
A
React must always be in the scope of the module when using JSX. JSX gets compiled into React objects that are then converted into JS.
3
Q
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
A
Using the babel-loader package alongside:
“@babel/core”: “^7.19.6”,
“@babel/plugin-transform-react-jsx”: “^7.19.0”,