Untitled
unknown
javascript
2 years ago
549 B
19
Indexable
import React, { useState } from 'react'
export const Test = (props) => {
// hooks to use spaecial functions of react
// useState : state,function to manipulate state
const[count,setcount]=useState(0); // declate state with function to manipulate with default value
return (
<div>
Test
<h1>Count: {count}</h1>
{/* onclic change state */}
<button
onClick={() => {
setcount(count + 1);
}}
>
Click
</button>
</div>
);
}
Editor is loading...
Leave a Comment