ktmud commented on a change in pull request #13220:
URL: https://github.com/apache/superset/pull/13220#discussion_r580507987
##########
File path: superset-frontend/src/components/FlashProvider/index.tsx
##########
@@ -37,21 +36,19 @@ const flashObj = {
success: 'addSuccessToast',
};
-class FlashProvider extends React.PureComponent<Props> {
- componentDidMount() {
- const flashMessages = this.props.common.flash_messages;
- flashMessages.forEach(message => {
+const FlashProvider: React.FC<Props> = ({ children, messages }) => {
Review comment:
@suddjian it's probably not a big issue anymore because of sourcemaps,
but it used to be useful because function names are captured in error stacks
which helps you to locate bad code in case of JS errors. I don't see additional
benefits of arrow functions in creating React components so I always follow the
named function style.
It's personal preference, so feel free to choose whatever style you like
until we adopt a styleguide just for consistency.
@yardz Prefix would be preferred even if the props are not exported, because
you never know whether you will export them later or add more components in the
same file. Always adding the prefix helps you not to have to worry about this.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]