Quiz
Review and reinforce your understanding of defining and managing strongly-typed function component props in React with TypeScript by completing this quiz. Ensure you grasp key concepts before advancing to state typing.
We'll cover the following...
We'll cover the following...
Creating strongly-typed function props
1.
Below is a component for a red button:
const RedButton = ({ children }) => (
<button style={{ backgroundColor: "red" }}>{children}</button>
);
What type annotation can we use to strongly type the props of the button? (There is more than one correct answer). Multi-select
A.
const RedButton: React.SFC = ({ children }) => ...
B.
const RedButton: React.FC = ({ children }) => ...
C.
const RedButton: React.Component = ({ children }) => ...
D.
const RedButton = ({ children }: {children: React.ReactNode}) => ...
1 / 5
Excellent, that’s ...