This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from "react"; | |
| import ReactDOM from "react-dom"; | |
| import "./styles.css"; | |
| const Header = ({ children, count }) => ( | |
| <h1> | |
| {children} ({count}) | |
| </h1> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState, useReducer, useContext } from "react"; | |
| import ReactDOM from "react-dom"; | |
| import "./styles.css"; | |
| const reducer = (todos, action) => { | |
| switch (action.type) { | |
| case "ADD_TODO": | |
| const newTodo = { id: todos.length + 1, name: action.payload }; | |
| return [...todos, newTodo]; | |
| case "REMOVE_TODO": |
OlderNewer