<div id="root">
</div>
console.clear();
const reducer = (state, action) => {
switch(action.type) {
default:
return { count: 0 }
}
}
const initialState = {
count: 0,
};
const App = () => {
const [state, dispatch] = React.useReducer(reducer, initialState);
return (
<div>
Count: { state.count }
</div>
)
}
const root = ReactDOM.createRoot(document.querySelector('#root'));
root.render(<App />);
View Compiled
This Pen doesn't use any external CSS resources.