Skip to main content

Knowledge check: Passing state - React Basic

Updated 1 min readMarkdown
Part of seriesReact Basics
Knowledge check: Passing state - React Basic
  1. What is the Context API?

    • An alternative way to working with state in React.

    • A way to change the execution context of a function in JavaScript.

  2. When working with useState to keep state in a variable, you should not use array destructuring.

    • True

    • False

  3. If a state variable is destructured from useState, and set to variable name of user, the name of the function to update the user state variable should be...

    • setUser

    • useState

    • userSetter

    • useUser

  4. What does the concept of “lifting up state” entail?

    • It involves moving the state from the parent component to the child component.

    • It involves moving the state from the child component to the parent component.

  5. What is a negative result of lifting up state in a React app?

    • It can significantly increase the number of components that you need to create.

    • There are no negatives from lifting up state in React.

    • Prop drilling.

About the author

No comments yet. Be the first to comment.

React Basics

Part 8 of 18

In this module you will explore the basic structure and use of the React.js library. You will learn how to produce single page web applications using React components and to use JSX to style them.

Up nextKnowledge Check: State the concept - React BasicIn React, can state be considered data? Yes No In React, can props be considered data? Yes No Choose the correct statement. The props object represents data that is external to a component, and state represents data that is internal to a c...

More from this blog