scrimba
Frontend Career Path
Advanced React
Reusability
Challenge - add onClick event listener
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Challenge - add onClick event listener
AboutCommentsNotes
Challenge - add onClick event listener
Expand for more info
index.js
run
preview
console
import React from 'react';
import ReactDOM from 'react-dom/client';
import Button from "./Button"
import { FcGoogle } from "react-icons/fc"

/**
* Challenge: Add an onClick handler to the Button
* component instance (the one on this page). Then
* make whatever changes you need for it to actually
* work.
*
* Clicking the button should log "Logging in..."
* to the console.
*/

function App() {
return (
<main>
<Button>
<FcGoogle />
Log in with Google
</Button>
</main>
)
}

ReactDOM.createRoot(document.getElementById('root')).render(<App />);
Console
/index.html
-2:52