-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Warning: Support for defaultProps will be removed from function components #2415
Comments
I'm running into this issue as well. The warning is quite long also, which makes it difficult to parse other logs that appear in the inspector. I understand this could be a large refactor... If anyone has suggestions for a hack to suppress warnings about this issue temporarily I would really appreciate it ❤️ |
Any updates on this? |
I tried to do the refactor (based in the similar issue that @donfour linked to the description) but the deploy has failed and I guess I don't have access to vercel to see the logs :( |
I fixed that by patching the if (process.env.NODE_ENV !== "production") {
// eslint-disable-next-line no-console
const originalWarn = console.error;
// eslint-disable-next-line no-console
console.error = (...args) => {
if (
args[0].includes(
"Support for defaultProps will be removed from function components in a future major release.",
)
) {
return;
}
originalWarn(...args);
};
} |
Hello! Any update on this issue? |
Sorry, I just didn't have the time to release, I'll try to find some time in the upcoming weeks. |
@dreampulse where did you put this code for it to work? |
Something similar is happening at recharts/recharts#3615 |
Done |
This issue has been fixed in the latest version ( |
Can someone guide me where to put above code? I am using NextJs |
In your Next.js page where we’re using react-beautiful-dnd, we are simply hiding the warning message without fixing it. Note: This approach uses defaultProps, which may be removed in React 19, so it’s only compatible with React 18.
|
Describe/explain the bug
Getting the following error when using Nivo with Next.js 13 inside
app
router:It doesn't affect the chart rendering though. It's just a bit annoying to see a long error in the console. Other libraries are also seeing a similar issue:
FunctionComp.defaultProps
is going to be deprecated in React 18.3.0 chakra-ui/chakra-ui#7057Wondering if Nivo has a plan to move from
defaultProps
to JS default parameters? It seems like quite a large refactor. Happy to contribute if needed. Thanks!To Reproduce
Codesandbox: https://codesandbox.io/p/sandbox/frosty-tom-fgddxp
Steps to reproduce the behavior:
Expected behavior
Rendering a chart should throw no error.
The text was updated successfully, but these errors were encountered: