Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yang Lin
committed
May 27, 2020
1 parent
0d99197
commit 3a8142f
Showing
2 changed files
with
12 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I think it's rare to see parent components passing a state setter function down to its children.
NewReplySection
should be only responsible for invoking event handlers likeonSubmissionComplete
on the right time. Since the snackbar lies inarticle/[id].js
, it should invokesetFlashMessage
when handlingonSubmissionComplete
.createReply
andconnectReply
to show the same flash message "The reply has been submitted.".onError
prop as error handler toNewReplySection
,NewReplySection
invoking the callback on error andarticle/[id].js
handles it properly. However, I think it's also OK if we directly invokealert()
on error, or process errors with other means withinNewReplySection
.