React Hooks in 1 minute

Yoko Spirig
1 min readMar 19, 2019

--

This is how you write a component with a state with the React framework traditionally. Notice the state variable on the second line.

This is how you write a component with a state with React Hooks. Notice that there’s no state variable defined.

You see that the only difference is, with React Hooks you don’t define a state variable but, instead, the function useState, included in the React framework, does it for you. That’s very basically what React Hooks does.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Yoko Spirig
Yoko Spirig

No responses yet

Write a response