Skip to main content

Knowledge Check: State the concept - React Basic

Updated 1 min readMarkdown
Part of seriesReact Basics
Knowledge Check: State the concept - React Basic
  1. In React, can state be considered data?

    • Yes

    • No

  2. In React, can props be considered data?

    • Yes

    • No

  3. Choose the correct statement.

    • The props object represents data that is external to a component, and state represents data that is internal to a component.

    • The props object represents data that is internal to a component, and state represents data that is external to a component.

  4. What does the useState hook do?

    • It allows a component to have its own state.

    • It allows a component to receive state from its parent.

  5. Based on the code below, is the userName variable external or internal data of the DisplayUser component?

     function DisplayUser(props) {
       return (
         <h1>{props.userName}</h1>
       );
     }
    
    • The userName value is data that is internal to the DisplayUser component

    • The userName value is data that is external to the DisplayUser component

About the author

No comments yet. Be the first to comment.

React Basics

Part 9 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: Data flow - React BasicUsually, a React app consists of many components, organized as a component tree. True False Uni-directional data flow is... The term that describes the one-way flow of components in a React app The term that describes the one-way flow of DOM u...

More from this blog