Skip to content

Implement todo app#1316

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

Implement todo app#1316
CyborgNinjaHat wants to merge 1 commit into
mate-academy:masterfrom
CyborgNinjaHat:develop

Conversation

@CyborgNinjaHat
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 job!

Be careful when throwing errors, because they need additional handling.

Many thanks!

Comment thread src/hooks/useTodoState.ts
Comment on lines +7 to +9
if (!state) {
throw new Error('useTodoState must be used within TodoProvider');
}
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 don't need to throw error in this case.
Because you need to handle this case in all places where you call useTodoState.

Comment on lines +9 to +11
if (!dispatch) {
throw new Error('useTodoActions must be used within TodoProvider');
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The same

Comment thread src/hooks/useInputRef.ts
const inputRef = useContext(TodoInputRefContext);

if (!inputRef) {
throw new Error('useInputRef must be used within TodoProvider');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the same

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