Quiz: Introducing the Function Components

Test your understanding of introduction to function components.

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>
    );
}
Question 1 of 50 attempted

Get hands-on with 1200+ tech skills courses.