Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript type for setstate function

//just define function with below
setValue : React.Dispatch<React.SetStateAction<string>>
  //example for boolean
  const ListsComponents: React.FC<{ setOpen?: React.Dispatch<React.SetStateAction<boolean>> }> = ({ setOpen }) => {
  const [currentSection, setCurrentSection] = useState<'home' | 'mint' | 'myNft' | 'roadmap'>('home');
  return (
    <div> Just demo<div/>
    )
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typescript #type #setstate #function
ADD COMMENT
Topic
Name
9+7 =