podefr / react-debounce-render

A React higher order component to debounce the rendering of your React components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Revert module.exports to export defaultl

cameracker opened this issue · comments

The change in the way the debounceRender function is exported (from export default to module.exports) has broken importing of the debounceRender, and is inconsistent with the documentation.

Now instead of import debounceRender from 'react-debounce-render';, imports must be import { debounceRender } from 'react-debounce-render';.

This isn't that big of a deal if you're only importing this once or twice, but if it is used pervasively, this creates a lot of extra work. Furthermore, because this repo is not using tags, there's not a great way to lock reliably to a particular version.

It is true that the readme said that "the extra default would be removed" but it wasn't actually necessary in the first place, and said nothing about the import changing.

My code was


export default debounceRender(MyComponent);```

and this worked great without the `default` in the example. 

Please do one of the folllowing:
1. Revert the export to use `export default` like before.
2. Update the documentation to show correct importing of the function.

thanks for raising this issue, I'll address it shortly

Thanks, I pushed version 3.0.0 (breaking change if pple were using the destructuring assginment in the import statement, hence the major version bump).
I also tagged the version.

Let me know if it fixes your issue, thanks again for raising it!

@wbazant I'd really appreciate if you could quickly test version 3.0.0 and confirm that I didn't break anything by changing the export statement :) simply npm installing the latest version and confirming that the module still gets properly imported is enough. Thanks!

I looked at the change, it looks right and also the better thing to do! How exports are set up- it looks standard- if the demo now works they are good. Thanks for the fix! We'll upgrade expression-atlas-heatmap-highcharts to use 3.0.0.

Also re tags nect time if you "npm version minor" it will upgrade the package.json, add a tag etc

Looks good!!

awesome, thanks guys!