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

defaultProps being deprecated #66

Closed
ethan-carlson opened this issue May 12, 2023 · 10 comments
Closed

defaultProps being deprecated #66

ethan-carlson opened this issue May 12, 2023 · 10 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question A valid question

Comments

@ethan-carlson
Copy link

Describe the bug
React defaultProps is scheduled to be deprecated in the next major release, 18.3: see here

To Reproduce
Steps to reproduce the behavior:
Mounting ImageMapper with React 18.2 generates this warning.

Error Stack
Warning: ImageMapper: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. at ImageMapper (webpack-internal:///(app-client)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/react-img-mapper/dist/ImageMapper.js:60:30)

Expected behavior
Change the default props syntax to the ES6 standard to remove this warning and prevent future bugs. See an example in this thread.

Screenshots
N/A

@Tsabary
Copy link

Tsabary commented Aug 7, 2023

I get this warning and nothing renders. Is this the same for you @ethan-carlson or do you get the component rendering? Just using the example code (replaced the json url with the actual json array)

@NishargShah
Copy link
Member

It is just a warning, the functionality will not affect due to this issue

@Tsabary
Copy link

Tsabary commented Aug 7, 2023

It is just a warning, the functionality will not affect due to this issue

In that case, I've added a new issue

@marcuspx
Copy link

marcuspx commented Nov 6, 2023

Any idea hot to fix or any library to get it on nextjs 13 ?

@NishargShah
Copy link
Member

Hello @marcuspx I am currently, working on it. please wait for sometime.

@ronalddas
Copy link

Hi, I am using Nextjs 14, in my localhost everything works fine , but after switching browser tabs, the highlighted portions dissapears (even after setting stayMultiHighlighted ) and the areas are no longer highlighted when I hover over them. If I do a full page refresh, it works fine again, are you also faching this @marcuspx ?

@NishargShah
Copy link
Member

Hello @ethan-carlson, this issue is resolved in the newer pre-release

Please check https://www.npmjs.com/package/react-img-mapper/v/2.0.0-alpha.1

Related to the Next.js highlighting issue, please create a separate one

Thanks :)

@NishargShah NishargShah self-assigned this Dec 24, 2023
@NishargShah NishargShah added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question A valid question labels Dec 24, 2023
@marcuspx
Copy link

@ronalddas ,for some reason in Local is showing the error but on production is not, no idea why but I'll wait for the stable version on nextjs from @NishargShah

@NishargShah
Copy link
Member

Hello @marcuspx, in the alpha version, it is resolved. Please wait till the stable release if you are using this package in any real projects

@abhithkba
Copy link

abhithkba commented Feb 19, 2024

This is not a solution but just a work around for this issue. This just hides the warning.

const error = console.error;
console.error = (...args) => { if (/defaultProps/.test(args[0])) return; error(...args); };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question A valid question
Projects
None yet
Development

No branches or pull requests

6 participants