Skip to content

implement solution#1310

Open
whomngmnt wants to merge 1 commit into
mate-academy:masterfrom
whomngmnt:develop
Open

implement solution#1310
whomngmnt wants to merge 1 commit into
mate-academy:masterfrom
whomngmnt:develop

Conversation

@whomngmnt
Copy link
Copy Markdown

Copy link
Copy Markdown

@DanilWeda DanilWeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Approved with minor comments.

Many thanks!


const { todos, filter } = context.state;
const visibleTodos = todos.filter(todo => {
if (filter === 'active') {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better option create Enum for filter status and use it in all place (one source of truth, easy changes in future )

import { useContext } from 'react';
import { FilterStatus, TodoContext } from '../Context/TodoContext';

const filters: { label: string; value: FilterStatus; dataCy: string }[] = [
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also you can use Enum for value in this case.

completed?: boolean;
};

export type Action =
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also can describe Actions as Enum (not critical)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants