Skip to content Skip to sidebar Skip to footer

Move Methods Out Of A React Component, But Still Access The State Object

I'm looking to refactor a rather unwieldy React component by moving some methods into a FooHelpers.js ES6 class, and then generalising them to work with other, related, React compo

Solution 1:

This is a perfect use case for a higher order component who's children will be the components related to your Foo.jsx. See more regarding HoCs in my answer to this question: https://stackoverflow.com/a/32729203/4190422.


Post a Comment for "Move Methods Out Of A React Component, But Still Access The State Object"