Skip to content
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

Remove DefaultProps, use JavaScript default parameters instead #103

Merged
merged 3 commits into from
Aug 23, 2023

Conversation

selven
Copy link

@selven selven commented Jul 13, 2023

#100
Remove DefaultProps, use JavaScript default parameters instead

Copy link
Owner

@mifi mifi left a comment

Choose a reason for hiding this comment

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

not sure what's the "correct" way to do this, but maybe we need to store them as a constant outside the component, for example:

// Outside component:
const emptyObject = {}
const rendererSettings: rendererSettingsIn = emptyObject


renderer = 'svg',
loop = true,
rendererSettings: rendererSettingsIn = {},
Copy link
Owner

@mifi mifi Jul 27, 2023

Choose a reason for hiding this comment

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

Wouldn't this cause renderSettings identity to change on every render (because a new object {} is created on every call), thereby causing excessive triggers of children/effects etc using it?

Comment on lines +29 to +33
onLoad = () => {},
onComplete = () => {},
onLoopComplete = () => {},
onEnterFrame = () => {},
onSegmentStart = () => {},
Copy link
Owner

Choose a reason for hiding this comment

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

same with these

@mifi mifi merged commit 90914be into mifi:master Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants