Search⌘ K

Quiz

Explore how to apply knowledge of strongly-typed function component state in React. This quiz helps reinforce concepts related to typing state using TypeScript with hooks such as useState and useReducer to improve code safety and clarity.

We'll cover the following...

Creating strongly-typed function component state

1.

What is the inferred type for the name state from the useState hook?

const [name, setName] = React.useState("");
A.

any

B.

string

C.

unknown


1 / 5

Now that we have got to ...