Inferno: Implement support for Inferno.memo ( React.memo )

Created on 8 Feb 2019  路  9Comments  路  Source: infernojs/inferno

Implement support for React.memo

Consider drop support for functional component hooks onComponent -API becomes useless after implementing this.

https://reactjs.org/blog/2018/10/23/react-v-16-6.html#reactmemo

feature request

All 9 comments

great to learn Inferno is going to support it, could you share an estimated date if possible?

Why will be all onComponent-API s becomes useless? React.memo replaces onComponentShouldUpdate but not the other hooks!?!

@chrkulbe Nothing is decided, there was discussion in Slack about dropping them. I recently did trial with this and we could maybe just add this functionality without any breaking changes

Maybe an inferno supported library for this? Keep the core light.

Hey @Havunen are there any updates on this?

No, I have not had time to work on this. I personally have no need for this functionality so its pretty low on my todo list. Would you like to work on this? As suggested by @tamb it would make sense to have this as separate opt-in module.

No, I have not had time to work on this. I personally have no need for this functionality so its pretty low on my todo list. Would you like to work on this? As suggested by @tamb it would make sense to have this as separate opt-in module.

Yeah, I can give it a go! Would like to use inferno on a project but we use MUI, so memo support is necessary (according to #1510) I wont have time to grab this until early next week

Thanks

@PorterK FYI: Our implementation in Preact might be of interested as a starting point:

https://github.com/preactjs/preact/blob/8825bf1ca2e4b5957556d9c6d385feceeffc242f/compat/src/memo.js#L11-L34

Hmm, we could try out if Preact approach works for us? In infernojs we can add SCU hook on functional component too using onComponentShouldUpdate that might be good fit for this feature

Was this page helpful?
0 / 5 - 0 ratings