useEffect( ) / Callback() / Reducer() / Context() Flashcards
The dependencies argument of useEffect(callback, dependencies) lets you control when the s____-e_____ runs.
The dependencies argument of useEffect(callback, dependencies) lets you control when the side-effect runs.
If the dependencies are not provided, the side-effect runs after _____ rendering.
If the dependencies are not provided, the side-effect runs after every rendering.
If the dependencies are an empty array [] the side-effect runs _____ after the ______ rendering.
If the dependencies are an empty array []: the side-effect runs once after the initial rendering.
If the dependencies has props or state values [prop1, prop2, …, state1, state2]: the side-effect runs ____ after____ rendering and then only when any d______ value changes.
If the dependencies has props or state values [prop1, prop2, …, state1, state2]: the side-effect runs once after initial rendering and then only when any dependency value changes.
The dependencies argument of the useEffect() lets you catch certain component lifecycle events: when the component has been m______-ed or a specific prop or state value has changed.
The dependencies argument of the useEffect() lets you catch certain component lifecycle events: when the component has been mounted or a specific prop or state value has changed.
M_____ing specifically refers to the process of inserting a component into the DOM for the first time.
Mounting specifically refers to the process of inserting a component into the DOM for the first time.
useEffect(callback, [prop, state]) invokes the callback once after mounting, and again after committing the changes to the ___, if and only if any value in the dependencies array [prop, state] has changed.
useEffect(callback, [prop, state]) invokes the callback once after mounting, and again after committing the changes to the DOM, if and only if any value in the dependencies array [prop, state] has changed.
By using the d________s argument of useEffect(), you control when the side-effect is called, independently from the rendering cycles of the component. Again, that’s the essence of useEffect() hook.
By using the dependencies argument of useEffect(), you control when the side-effect is called, independently from the rendering cycles of the component. Again, that’s the essence of useEffect() hook.
By using the dependencies argument of useEffect(), you control _____ the side-effect is called, independently from the rendering cycles of the component. Again, that’s the essence of useEffect() hook.
By using the dependencies argument of useEffect(), you control when the side-effect is called, independently from the rendering cycles of the component. Again, that’s the essence of useEffect() hook.
If the callback of useEffect(callback, deps) returns a f______, then useEffect() considers that function as an effect cleanup
If the callback of useEffect(callback, deps) returns a function, then useEffect() considers that function as an effect cleanup
If the callback of useEffect(callback, deps) returns a function, then useEffect() considers that function as an effect c_____
~~~
useEffect(function callback() => {
// Side-effect…
return function cleanup() { ««««
// Side-effect cleanup… ««««
};
}, dependencies);
~~~
If the callback of useEffect(callback, deps) returns a function, then useEffect() considers that function as an effect cleanup
Cleanup works the following way:
A) After i_____ rendering, useEffect() invokes the callback with the side-effect. cleanup function is ___ invoked.
B) On later renderings, before invoking the next side-effect callback, useEffect() i_____s the cleanup function from the previous side-effect execution (to clean up everything after the previous side-effect), then i______s the current side-effect.
C) Finally, after unm_____ing the component, useEffect() invokes the cleanup function from the latest side-effect.
Cleanup works the following way:
A) After initial rendering, useEffect() invokes the callback with the side-effect. cleanup function is not invoked.
B) On later renderings, before invoking the next side-effect callback, useEffect() invokes the cleanup function from the previous side-effect execution (to clean up everything after the previous side-effect), then invokes the current side-effect.
C) Finally, after unmounting the component, useEffect() invokes the cleanup function from the latest side-effect.
useCallback(callbackFun, deps) is helpful when given the same dependency values as deps, the hook returns the same function instance between renderings (aka m______tion):
useCallback(callbackFun, deps) is helpful when given the same dependency values as deps, the hook returns the same function instance between renderings (aka memoization)
Context.Provider component available on the context instance is used to provide the context to its ____ components, no matter how deep they are.
Context.Provider component available on the context instance is used to provide the context to its child components, no matter how deep they are.
Context.P____ component available on the context instance is used to provide the context to its child components, no matter how deep they are.
Context.Provider component available on the context instance is used to provide the context to its child components, no matter how deep they are.