Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



State Hooks

State lets a component “remember” information like user input. For example, a form component can use state to store the input value, while an image gallery component can use state to store the selected image index.

To add state to a component, use one of these Hooks:

 function ImageGallery ( ) { 
const [ index , setIndex ] = useState ( 0 ) ;
// ...
If you want to change selection, open document below and click on "Move attachment"

Built-in React Hooks – React
eact Hooks Hooks let you use different React features from your components. You can either use the built-in Hooks or combine them to build your own. This page lists all built-in Hooks in React. <span>State Hooks State lets a component “remember” information like user input. For example, a form component can use state to store the input value, while an image gallery component can use state to store the selected image index. To add state to a component, use one of these Hooks: useState declares a state variable that you can update directly. useReducer declares a state variable with the update logic inside a reducer function. function ImageGallery() { const [index, setIndex] = useState(0); // ... Context Hooks Context lets a component receive information from distant parents without passing it as props. For example, your app’s top-level component can pass the current UI theme to


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.