Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Update the block component to use react hooks instead #14985
I said previously that we're not going to refactor our components to use hooks just to use hooks. But in this PR, I'm trying to refactor the
The main reasons are:
At the moment, I kept the refactoring as minimal as I can, which means I kept, in theory, the same flows, states... There's something different though which can be impactful. A lot of the callbacks are not bound the instance object which means some child components might rerender more often. There are options and solutions but I want to measure the differences before making changes.
requested review from
Apr 15, 2019
This is a good start. Making this code more straightforward is going to help always keeping a cleaner state for any future iterations.
There's another motivation for making use of hooks here which is getting some more concrete awareness of how they can later benefit the consumable block API (exposing some of what has been so far absorbed in
I run the performance tests to compare this branch against master and noticed similar times. This refactor has no impact on performance.
Can I get a review here, I'm thinking of merging this as is and try other smaller improvements using hooks separately.
2 times, most recently
Apr 16, 2019
referenced this pull request
Apr 18, 2019
aduth left a comment
It's a bit difficult to review, but it appears in good shape. I like how hooks help to consolidate where previously we have disjointedness of checking for changes in props values between
The issue with the ESLint warning should probably be resolved. There's also a merge conflict.