React useState Hook

import React, { useState } from React
function LikeButton(){
const [likes, setLikes] = useState(0);
}
function LikeButton(){
const [likes, setLikes] = useState(0);
return(
<div>
<h3>Likes:{likes}</h3>
<button onClick={() => setLikes(likes + 1)}>
Like Me!
</button>
</div>
)
}

--

--

--

Full-stack web developer with a background in the service industry, sound design, audio engineering, and theatre performance.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

3 Steps for Developing a Responsive navbar

Intigriti — XSS Challenge — February 2022 — Bug Bounty Hunting — Writeup

Don’t start with React

RxJS in-depth: Github repo ‘utils’ directory review (part 1)

How Nucleoid Learns

What’s not to like? Let’s make a like button with numbers in React!

Journey of DLithe Bootcamp .NET Full Stack Developer | Week 2(March28-April2)

Using the WAMP protocol for your Node.js IPC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kamrin Kennedy

Kamrin Kennedy

Full-stack web developer with a background in the service industry, sound design, audio engineering, and theatre performance.

More from Medium

Implementing UseContext In React

React 18 new features.

React 18 vs React 17 — Batching Renders

How to Get Started with Bootstrap in React