Untitled

 avatar
unknown
javascript
a year ago
549 B
7
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