Paradox (Tisdag)
Angler (Onsdag)
Ferroamp (Onsdag)
Embracer (Torsdag)
Aktietjuven lägger ut nytt case 18:00.
Because context uses reference identity to determine when to re-render, there are some gotchas that could trigger unintentional renders in consumers when a provider’s parent re-renders.
To get around this, lift the value into the parent’s state:
class App extends React.Component {
constructor(props) {
super(props);
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class.
import React, { useState } from 'react';
A Hook is a special function that lets you “hook into” React features. In a function component, we have no this, so we can’t assign or read this.state. Instead, we call the useState Hook directly inside our component:
| props | state | |
|---|---|---|
| Can get initial value from parent Component? | Yes | Yes |