React Hook Example: useState
Below is an example of React hook useState to change the state of a boolean.
const MyCustomButton: React.FC<Props> = props => {
// first argument defines the variable
// second argument defines the funtion that changes the state
// third - the assignment sets initial state
const [open, setOpen] = React.useState<boolean>(false);
return (
<Button
onClick={() => setOpen(true)} // calls the function that will set the state
>
);
};