Skip to main content

Command Palette

Search for a command to run...

Self review: Passing props - React Basic

Updated
1 min read
Self review: Passing props - React Basic
D

A passionate full-stack developer from @ePlus.DEV

  1. True or False: In React, props is an object.

    • True

    • False

  2. True or False: You can pass a prop to a component by adding an attribute to the component being rendered, with the attribute’s value becoming the value of the passed-in prop

    • True

    • False

  3. What is the error in the code below?

     function Greeting() {
         return <h1>Hello, {props.name}</h1>
     }
     export default Greeting
    
    • The Greeting function should receive a props parameter.

    • You need to add extra spacing after the function's name.

    • You should always add a pair of parentheses after the return keyword.

More from this blog

E

ePlus.DEV - Exploring Technology with David Nguyen

1241 posts

A passionate full-stack developer from VIETNAM.