Skip to content

task#2127

Open
NiaAnastasia wants to merge 2 commits intomate-academy:masterfrom
NiaAnastasia:develop
Open

task#2127
NiaAnastasia wants to merge 2 commits intomate-academy:masterfrom
NiaAnastasia:develop

Conversation

@NiaAnastasia
Copy link

Copy link

@Anton-Kuchmasov Anton-Kuchmasov left a comment

Choose a reason for hiding this comment

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

Good job!

Just a couple of tiny fixes need to be done:

src/App.tsx Outdated
export const App: React.FC = () => {
if (!USER_ID) {
const [todos, setTodos] = useState<Todo[]>([]);
const [errorMessage, setErrorMessage] = useState('');

Choose a reason for hiding this comment

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

Suggested change
const [errorMessage, setErrorMessage] = useState('');
const [errorMessage, setErrorMessage] = useState<ErrorMessage | null>(null);

src/App.tsx Outdated

setTodos(prev => prev.map(t => (t.id === todo.id ? updatedTodo : t)));
} catch {
showError('Unable to update a todo');

Choose a reason for hiding this comment

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

Just reuse your ErrorMessage enum here to avoid typo mistakes

src/App.tsx Outdated
hasTodos={todos.length > 0}
/>

{(todos.length > 0 || tempTodo) && (

Choose a reason for hiding this comment

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

Suggested change
{(todos.length > 0 || tempTodo) && (
{(!!todos.length || tempTodo) && (

src/App.tsx Outdated
}
isLoading={isLoading}
onToggleAll={onToggleAll}
hasTodos={todos.length > 0}

Choose a reason for hiding this comment

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

Suggested change
hasTodos={todos.length > 0}
hasTodos={!!todos.length}

@NiaAnastasia
Copy link
Author

DEMO LINK

Copy link

@2pasha 2pasha left a comment

Choose a reason for hiding this comment

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

lgtm 🔥

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.

3 participants