Set types on useState React Hook with TypeScript

Use this

const [user, setUser] = useState<IUser>({name: 'Jon'});

See the Corresponding Type in DefinitelyTyped

Leave a Comment