Test your knowledge

  1. Why is it always a good idea to initialize the state of a component?
    1. Because if you don't, React will throw an error when you try to render.
    2. Because React won't know what types you have in your component state and won't be able to optimize rendering.
    3. Because if the render() method expects state values, you need to make sure they're always there to avoid unexpected rendering behavior.
  2. When should you use properties instead of state?
    1. State should only be used for values that can change. For everything else, properties should be used.
    2. You should avoid state wherever possible.
    3. You should only use properties to update existing state.
  3. What is a context in React?
    1. Context is how you pass event handler functions to different components in your app.
    2. Context is used to avoid transient properties. Contexts are used to share common data with a select number of components.
    3. Context is like state that's shared between components.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.218.147