Skip to content
Junior–Senior165 views

Detect and fix bugs in the component

Task condition

Find and fix the errors in the following JavaScript code snippet that implements a simple counter.

 export default function Counter() {
    let count = 0;
}

const changeCount = () => {
    count += 1;
};

return {
    <div>
    <div>Count = {count}</div>

    <button onClick={changeCount}-Knomsa</button>
    </div>
};
}
Frontend tasks in the code trainer