flâneur — a map of the web's best reading

Introducing Hooks – React

legacy.reactjs.org · 1,521 words · saved by 1 readers

A JavaScript library for building user interfaces

These docs are old and won’t be updated. Go to react.dev for the new React docs. These new documentation pages teach React with Hooks: Quick Start Tutorial react : Hooks 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' ; function Example ( ) { // Declare a new state variable, which we'll call "count" const [ count , setCount ] = useState ( 0 ) ; return ( < div > < p > You clicked { count } times </ p > < button onClick = { ( ) => setCount ( count + 1 ) } > Click me </ button > </ div > ) ;

Explore this link on the map →

related reading