Quiz
In this quiz, we will test what we have learned about strongly-typed function component props with TypeScript
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}) => ...
Question 1 of 50 attempted
Access this course and 1400+ top-rated courses and projects.