React (Basic) Flashcards
To add a state variable, import useS_._. from React at the top of the file
To add a state variable, import useState from React at the top of the file
The idea of JSX is quite similar to many t____ing languages
The idea of JSX is quite similar to many templating languages
effect hooks are precisely the right tool to use when f____ing data from a server.
effect hooks are precisely the right tool to use when fetching data from a server.
The useState function (and useEffect) must not be called from inside of a L____, a c________ expression, or any place that is not a function defining a com______
The useState function (and useEffect) must not be called from inside of a loop, a conditional expression, or any place that is not a function defining a component
The axios ‘get’ method returns a p_____
The axios get method returns a promise
a call to a state-updating function triggers the re-r________-ing of the component
a call to a state-updating function triggers the re-rendering of the component
The second parameter of useEffect is used to specify how o____ the effect is run. If the second parameter is an empty array [], then the effect is only run along with the f____ render of the component.
The second parameter of useEffect is used to specify how often the effect is run. If the second parameter is an empty array [], then the effect is only run along with the first render of the component.
All events propagate in React except onS_._.., which only works on the JSX tag you attach it to.
All events propagate in React except onScroll, which only works on the JSX tag you attach it to.
The browser gets the JavaScript from the React d__ s______, which is the application that runs after running the command npm run dev
The browser gets the JavaScript from the React dev server, which is the application that runs after running the command npm run dev
Functions that create actions are called a____ c_____s.
Functions that create actions are called action creators.
axios is installed as a runtime dependency of the application because the execution of the program requires the existence of the l_____
axios is installed as a runtime dependency of the application because the execution of the program requires the existence of the library
React treats a component defined inside of another component as a n____ component in every render
React treats a component defined inside of another component as a new component in every render
the content of a React component (usually) needs to contain one r.._ element.
the content of a React component (usually) needs to contain one root element.
Effects let a component connect to and synchronize with ex____ systems
Effects let a component connect to and synchronize with external systems
_ _ _ is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file.
JSX is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file.
One best practice in React is to L____ the s____ up in the component hierarchy.
One best practice in React is to lift the state up in the component hierarchy.
In React, it’s conventional to use ..Something names for props which take functions which handle events and h____Something for the actual function definitions which handle those events.”
In React, it’s conventional to use onSomething names for props which take functions which handle events and handleSomething for the actual function definitions which handle those events.”
rendering completely different React elements depending on the state of the application is called c________ rendering
rendering completely different React elements depending on the state of the application is called conditional rendering
Under the hood, JSX returned by React components is c________ed into JavaScript.
Under the hood, JSX returned by React components is compiled into JavaScript.
Local variables don’t persist between r________s.
Local variables don’t persist between renders
An event handler is supposed to be either a f________ or a f________ reference
An event handler is supposed to be either a function or a function reference
useEffect takes _ parameters
useEffect takes 2 parameters
When a software developer uses React, they rarely or never directly manipulate the D._
When a software developer uses React, they rarely or never directly manipulate the DOM
I_._x as a key is an anti-pattern
Index as a key is an anti-pattern
Effects are an “es____ h____” from the React paradigm.
Effects are an “escape hatch” from the React paradigm.
React treats a component defined inside of another component as a new component in every r_______
React treats a component defined inside of another component as a new component in every render
JSX is a s_____ extension for JavaScript that lets you write HTML-like markup inside a JavaScript file.
JSX is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file.
Unlike the “normal” props we’ve seen before, c________ is automatically added by React and always exists.
Unlike the “normal” props we’ve seen before, children is automatically added by React and always exists.
Local variables don’t p____ between renders.
Local variables don’t persist between renders.
Remember that the correct way of updating state stored in complex data structures like objects and arrays is to make a c____ of the s____
Remember that the correct way of updating state stored in complex data structures like objects and arrays is to make a copy of the state
middleware functions are called in the order that they’re encountered by the JavaScript e______
middleware functions are called in the order that they’re encountered by the JavaScript engine
By default, React DOM es_._.s 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. This helps 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. This helps prevent XSS (cross-site-scripting) attacks.
E.._._s are an “escape hatch” from the React paradigm.
Effects are an “escape hatch” from the React paradigm.
Actions are o_._._s, which have at least a field determining the type of the action
Actions are objects, which have at least a field determining the type of the action
Never d____ components inside of other components
Never define components inside of other components
Event handlers will also catch events from any c_____ your component might have
Event handlers will also catch events from any children your component might have
The optimization process for JavaScript files is called m_______.
The optimization process for JavaScript files is called minification.
a k._ is the only thing React uses to identify DOM elements
a key is the only thing React uses to identify DOM elements
Changing state has to always be done by setting the state to a new o______
Changing state has to always be done by setting the state to a new object
“Objects are not valid as a React c____”
Objects are not valid as a React child
state update in React happens a____________ly
state update in React happens asynchronously
Don’t use Effects to orchestrate the d____ f____ of your application
Don’t use Effects to orchestrate the data flow of your application