Untitled

mail@pastecode.io avatar
unknown
javascript
14 days ago
549 B
4
Indexable
Never
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>
  );
  }
Leave a Comment