REACT JS QUIZ
1 .
What are two ways data gets handled in react?

Correct Answer : Option (A)

state & props
  Show Answer
2 .
What do you call the message wrapped in curly braces below?
let message = 'Hi there';
const element = <p>{message}</p>;

Correct Answer : Option (D)

a JS expression
  Show Answer
3 .
What can you use to handle code splitting?

Correct Answer : Option (B)

React.lazy
  Show Answer
4 .
When do you use useLayoutEffect?

Correct Answer : Option (D)

when you need the browser to paint before the effect runs
  Show Answer
5 .
You have written the following code but nothing is rendering. How do you fix this problem?
const Heading = () => {
  <h1>Hello!</h1>;
};

Correct Answer : Option (D)

Change the curly braces to parentheses or add a return statement before the h1 tag.
  Show Answer
6 .
Which of these terms commonly describe React applications?

Correct Answer : Option (A)

declarative
  Show Answer
7 .
What is the children prop?

Correct Answer : Option (A)

a property that lets you pass components as data to other components
  Show Answer
8 .
Why is it important to avoid copying the values of props into a component's state where possible?

Correct Answer : Option (D)

because you want to allow a component to update in response to changes in the props 
  Show Answer
9 .
When might you use React.PureComponent?

Correct Answer : Option (C)

when you want a default implementation of shouldComponentUpdate()
  Show Answer
10 .
How do you destructure the properties that are sent to the Dish component?
function Dish(props) {
  return (
    <h1>
      {props.name} {props.cookingTime}
    </h1>
  );
}

Correct Answer : Option (B)

function Dish({name, cookingTime}) { return <h1>{name} {cookingTime}</h1>; }  
  Show Answer