scrimba
Frontend Career Path
Advanced React
Performance
StrictMode - rerunning side effects
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

StrictMode - rerunning side effects
AboutCommentsNotes
StrictMode - rerunning side effects
Expand for more info
index.jsx
run
preview
console
import React from 'react';
import ReactDOM from 'react-dom/client';
import { faker } from "@faker-js/faker"

import Timer from "./Timer"

function App() {
const [showTimer, setShowTimer] = React.useState(false)

function toggleTimer() {
setShowTimer(prev => !prev)
}

return (
<div>
<button className="button" onClick={toggleTimer}>{showTimer ? "Hide" : "Show"} Timer</button>
{showTimer &&
<Timer />
}
</div>
)
}
ReactDOM.createRoot(document.getElementById('root')).render(
// <React.StrictMode>
<App />
// </React.StrictMode>
);
Console
/index.html
-6:27