Skip to content

Commit

Permalink
Remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed May 29, 2024
1 parent ca6f758 commit c2b747e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
9 changes: 5 additions & 4 deletions src/components/TodoApp/Todo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export const Todo = memo((props: TodoProps) => {
const { className, todo, onToggleTodo, onDeleteTodo, onUpdateTodoText } = props;

const [text, setText] = useState(todo.text);

useEffect(() => {
setText(todo.text);
}, [todo.text]);

const [isEditing, setIsEditing] = useState(false);

const onEditButtonClick = useEvent(() => {
Expand All @@ -43,10 +48,6 @@ export const Todo = memo((props: TodoProps) => {

const { classes, cx } = useStyles({ isEditing });

useEffect(() => {
setText(todo.text);
}, [todo.text]);

return (
<div className={cx(classes.root, className)}>
<Checkbox checked={todo.isDone} onChange={() => onToggleTodo()} />
Expand Down
22 changes: 1 addition & 21 deletions src/components/TodoApp/TodoApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,10 @@ type Props = {
};

export function TodoApp(props: Props) {
const { className, todos } = props;
const { className, todos, onAddTodo, onDeleteTodo, onToggleTodo, onUpdateTodoText } = props;

const { classes, cx } = useStyles();

const onAddTodo = (text: string) => {
console.log(`Adding todo with text: ${text}`);
props.onAddTodo(text);
};

const onUpdateTodoText = (id: string, text: string) => {
console.log(`Updating todo with id: ${id} and text: ${text}`);
props.onUpdateTodoText(id, text);
};

const onToggleTodo = (id: string) => {
console.log(`Toggling todo with id: ${id}`);
props.onToggleTodo(id);
};

const onDeleteTodo = (id: string) => {
console.log(`Deleting todo with id: ${id}`);
props.onDeleteTodo(id);
};

/*
Example:
Expand Down

0 comments on commit c2b747e

Please sign in to comment.