-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #1491
base: master
Are you sure you want to change the base?
Develop #1491
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Job 👍
let's improve your solution
Review the attached video and fix the bug.
https://www.loom.com/share/ddbab52f666943d7a3fc6aa58c05105f
todoFromService | ||
.getTodos() | ||
.then(setTodos) | ||
.catch(() => setErrorMessage(TypeError.LOADING)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to move the logic inside the useEffect
hook to a separate function, as it improves code readability, reusability, and makes testing easier. It also helps keep useEffect
focused on side effects.
setErrorMessage: React.Dispatch<React.SetStateAction<TypeError>>; | ||
}; | ||
|
||
export const Error: React.FC<Props> = ({ errorMessage, setErrorMessage }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const Error: React.FC<Props> = ({ errorMessage, setErrorMessage }) => { | |
export const Error: FC<Props> = ({ errorMessage, setErrorMessage }) => { |
DEMO LINK