-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 #860
base: master
Are you sure you want to change the base?
Develop #860
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.
Please provide demo link
src/components/PostsList.tsx
Outdated
? post | ||
: null)} | ||
> | ||
{post.id !== selectedPostId ? 'Open' : 'Close'} |
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.
{post.id !== selectedPostId ? 'Open' : 'Close'} | |
{!isSelected ? 'Open' : 'Close'} |
better to make variable const isSelected = post.id === selectedPostId
and use in all places
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.
addded
src/components/NewCommentForm.tsx
Outdated
const [value, setValue] = useState({ | ||
name: '', | ||
email: '', | ||
body: '', | ||
}); |
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.
make outside component constant with initial values and use in both places.
same for isError state
const initialValue = {
name: '',
email: '',
body: '',
}
const [value, setValue] = useState({ | |
name: '', | |
email: '', | |
body: '', | |
}); | |
const [value, setValue] = useState(initialValue); |
src/components/NewCommentForm.tsx
Outdated
setValue({ | ||
name: '', | ||
email: '', | ||
body: '', | ||
}); |
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.
setValue({ | |
name: '', | |
email: '', | |
body: '', | |
}); | |
setValue(initialValue); |
|
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.
Well done 👍 Go ahead!
DEMO LINK
initial commit done