Quiz
In this quiz, we will test what we have learned about strongly-typed function component props with TypeScript
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).
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 ...