React: React setState callback not called for external (npm packaged) component

Created on 13 Apr 2018  路  4Comments  路  Source: facebook/react

I'm creating one npm package with react. But setState callback is not working in the npm package that I build. I used [email protected].

I tried with [email protected] and everything is working fine.

Any help for resolve the issue in 16.3.1 will be appreciated !!

Needs More Information

Most helpful comment

You need to fix your component to not bundle React with it. React should be a peerDependency of your component, not a dependency.

Otherwise you'll keep getting similar issues with each new release.

All 4 comments

@midhun1001 you should create a working example (for instance in https://codesandbox.io) that reproduces the problem.

I found out the cause of problem. Version compatibility issues. I used 15.6.x in my component and 16.3.1 in the custom build npm package.

When i made both 16.3.1, it worked well !!

You need to fix your component to not bundle React with it. React should be a peerDependency of your component, not a dependency.

Otherwise you'll keep getting similar issues with each new release.

thanks @gaearon

Will do that.

Was this page helpful?
0 / 5 - 0 ratings