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 & propTypes #658

Merged
merged 2 commits into from
May 13, 2024
Merged

remove defaultProps & propTypes #658

merged 2 commits into from
May 13, 2024

Conversation

skb1129
Copy link
Contributor

@skb1129 skb1129 commented May 8, 2024

Checks

Description

The newer versions of React and React Native are deprecating the use of defaultProps and propTypes.
This PR removes all the uses of defaultProps and uses JS default values.
This PR removes all the uses of propTypes in favour of using TypeScript props type.

Copy link
Collaborator

@jsamr jsamr left a comment

Choose a reason for hiding this comment

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

Great initiative, truly appreciated! Please be aware of my memoization comment though. Using inline values will break memoization, consider instead extracting those default values to a referentially stable object.

packages/render-html/src/TNodeChildrenRenderer.tsx Outdated Show resolved Hide resolved
packages/render-html/src/hooks/useTRenderEngine.ts Outdated Show resolved Hide resolved
@skb1129
Copy link
Contributor Author

skb1129 commented May 8, 2024

@jsamr thank you for the review, please let me know if you find any other issues.

@skb1129 skb1129 requested a review from jsamr May 8, 2024 14:50
@skb1129 skb1129 marked this pull request as ready for review May 10, 2024 07:32
@jsamr jsamr merged commit f0c7e34 into meliorence:master May 13, 2024
@pdb3616109
Copy link

I tried to use your code to update the local file, but a warning was prompted during the use.
👇👇👇👇👇
image

WARN You seem to update props of the "TRenderEngineProvider" component in short periods of time, causing costly tree rerenders (last update was 51.33ms ago). See https://stackoverflow.com/q/68966120/2779871

@SerSerch
Copy link

@pdb3616109 create a new component and wrap it in memo

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.

4 participants