Cannot read properties of null using Reactjs

I am working on Reactjs and using “nextjs framework”,Right now i am trying to create component (functional) but i am getting following error

Cannot read properties of null (reading 'useState')

Here is my current code,Where i am wrong ?

import React from 'react'
import Link from "next/link";
import { useEffect, useState } from "react";
import { error } from 'jquery';

const clearinputs = (event) => {
    const data = {
      name: state.name
    };
    setState({
      ...state,
      name: ""
    });
  }

const [state, setState] = useState({
    name: "",
    email: "",
  });