Skip to content

remove defaultProps from CometChatBadge, use default params instead#71

Open
kyleshevlin wants to merge 2 commits intocometchat:v4from
kyleshevlin:patch-2
Open

remove defaultProps from CometChatBadge, use default params instead#71
kyleshevlin wants to merge 2 commits intocometchat:v4from
kyleshevlin:patch-2

Conversation

@kyleshevlin
Copy link

defaultProps will be deprecated for function components soon. This uses default parameters instead and suppresses a React Native warning.

`defaultProps` will be deprecated for function components soon. This uses default parameters instead and suppresses a React Native warning.
count= 0,
style: propsStyle= new BadgeStyle({}),
} = props;
export const CometChatBadge = ({ count = 0, style = new BadgeStyle({}) }: CometChatBadgeProps) => {
Copy link
Author

Choose a reason for hiding this comment

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

Technically, I made this change first. You don't need the props object for anything else, so just destructure inline. Plus, the correct spacing usage for the =.

*/
interface CometChatBadgeProps {
count: number;
count?: number;
Copy link
Author

Choose a reason for hiding this comment

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

Your type is either incorrect, or you don't need to set a default count. It's one or the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant