React Docs Flashcards
(33 cards)
What is the command to create a new project using NPM?
npm init -y
What does Babel do?
It accepts ES6 and React code as input, and creates regular JavaScript as output.
What is the process of converting ES6 source code to old-school JS called?
Transpiling.
What does Webpack do?
it is a tool that converts all our source code into one finished app ready to ship to users. It is controlled by the webpack.config.js file.
What npm package allows you to run a webpack dev server locally?
webpack-dev-server
What does the “export” keyword mean?
It means that the component is being exposed to the rest of the app to use.
What does the “default” keyword mean?
It means its the only thing this class will expose.
What is hot loading?
It’s a way to update the code in a running application without restarting or resetting the application state.
What does ReactDOM do?
It imports the React tools required to render to the DOM.
What two parameters does ReactDOM.render take?
Some JSX to render and where to render it to.
How does JSX know what means?
From the name it is imported under.
What is JSX?
It is a syntax extension to JavaScript. It produces React elements.
How can you embed any JavaScript expression in JSX?
Wrap it in curly braces.
Why is it recommended that you wrap multi-line JSX in parentheses?
To avoid the pitfalls of automatic semicolon insertion.
What do JSX expressions become after compilation?
Regular JavaScript objects.
Why shouldn’t you put quotes around curly braces when embedding a JS expression in a JSX attribute?
JSX will treat the attribute as a string literal rather than an expression.
Does ReactDOM use camelCase property naming conventions in JSX, or HTML attribute names?
camelCase. Example- HTML class is className in JSX. This is because JSX is closer to JavaScript than HTML.
How does JSX prevent XSS (cross-site-scripting) attacks?
By default, React DOM escapes any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that’s not explicitly written in your application. Everything is converted to a string before being rendered.
What does Babel compile JSX down to?
React.createElement() calls.
What syntax scheme should you search for in a code editor to ensure that both ES6 and JSX code is properly highlighted?
Babel syntax scheme.
What are JSX objects called?
React elements.
What are the smallest building blocks of React apps?
elements.
What takes care of updating the DOM to match the react elements?
React DOM
How are React elements different from browser DOM elements?
They are plain objects, and are cheap to create.