Skip to content

React 19 compability #159

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

Open
wille opened this issue Jul 12, 2024 · 1 comment
Open

React 19 compability #159

wille opened this issue Jul 12, 2024 · 1 comment

Comments

@wille
Copy link

wille commented Jul 12, 2024

React 19 is phasing out defaultProps and React 18.3.1 is throwing deprecation warnings

image

@Moryee
Copy link

Moryee commented Mar 11, 2025

I don't think there will be any response, but I created patch file for this issue and pull request.
About patch-package

Patch file:

diff --git a/lib/component/stringify.js b/lib/component/stringify.js
index 861dcbc8aa9c4d7ff7440b230c5416a59f6d4d72..788ce6e8d8c530565aad9e3fbcd956c5f620df7e 100644
--- a/lib/component/stringify.js
+++ b/lib/component/stringify.js
@@ -8,13 +8,12 @@ module.exports = R.curry(function stringify (opts, tree) {
         'var React = require(\'react\');',
         '',
         'function ' + displayName + ' (props) {',
+        'props = {...' + JSON.stringify(tree.props || {}) + ', ...props};\n',
     ];
 
     var postamble = [
         '}',
         '',
-        displayName + '.defaultProps = ' + JSON.stringify(tree.props || {}) + ';',
-        '',
         'module.exports = ' + displayName + ';',
         '',
         displayName + '.default = ' + displayName + ';',

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

No branches or pull requests

2 participants