Quiz: Introducing the Function Components
Test your understanding of introduction to function components.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
What is the correct way to declare a function component that passes another function as a prop?
A.
const Title = ( getContentFunction ) => {
const handleClick => {
getContentFunction();
};
return (
<div>
<button onClick=handleClick>Click me</button>
</div>
);
}
B.
const Title = ( getContentFunction() ) => {
const handleClick = () => {
getContentFunction();
};
return (
<div>
<button onClick=handleClick()>Click me</button>
</div>
);
}
C.
const Title = ({ getContentFunction }) => {
const handleClick = () => {
getContentFunction();
};
return (
<div>
<button onClick={handleClick}>Click me</button>
</div>
);
}
D.
const Title = ({ getContentFunction() }) => {
const handleClick = () => {
getContentFunction();
};
return (
<div>
<button onClick={handleClick}>Click me</button>
</div>
);
}
1 / 5
...