Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions content/docs/hooks-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import React, { useState } from 'react';

function Example() {
// Declare a new state variable, which we'll call "count"
// and a function "setCount" which we will call to update "count
const [count, setCount] = useState(0);

return (
<div>
<p>You clicked {count} times</p>
//Over here we are calling the function setCount and passing it the value we want it to assign to "count"
<button onClick={() => setCount(count + 1)}>
Click me
</button>
Expand Down