remove the "stack", use HOCs instead
See original GitHub issue@rockymeza had the very interesting idea, in our Slack, of writing plugins as React components. Potentially even using HOCs to re-implement all of the logic that is currently handled by the custom plugin system.
I think this is really interesting, and has the potential to simplify some things in core, and kinda seems obvious now that I think about it, which good ideas often do.
Haven’t fully fleshed this out yet, but…
- We could get rid of the
Stack
concept, since HOCs would imply the ordering, and they can easily override or passthrough to the Editor as they please. This would also eliminate the potential hidden performance impact to re-creating the stack on every render, since it would be obvious that re-creating the Component on every render would have negative performance impacts. - We could remove the
render
andrenderPortal
properties of plugins, since they would be supported automatically with HOCs. - We might be able to remove storing state in
this.state.state
, and instead just usethis.props.state
, simplifying some logic.
If you have thoughts, please add! Especially if there are holes that aren’t possible with HOCs that we’d need to figure out.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Warning when using react hooks in HoC - Stack Overflow
When I write a HoC, I often have to disable the rules-of-hooks eslint rule because the rule is too stringent wrt what it...
Read more >Higher-Order Components - React
A higher-order component (HOC) is an advanced technique in React for reusing component logic. HOCs are not part of the React API, per...
Read more >Refactoring Higher-Order Components (HOC) to React Hooks
In this post I'll be converting one of these HOCs to a custom Hook, to demonstrate the power of this "new" pattern. Sidenote:...
Read more >Why hooks are the best thing to happen to React
With hooks, it's now simpler to learn React; because of this, its use in the tech world today has grown: A chart showing...
Read more >Stack Marks - Tableau Help
When marks are stacked, they are drawn cumulatively along an axis. ... Instead, they are drawn independently from the horizontal axis. Back to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have managed to get some time from work to work on this the next two weeks. I’m going to put a base together and port some of our internal plugins to it. I’m going to try to come with something as ergonomic as possible first and then think about how to port the legacy plugins to it. I will post back here when I have something to look at.
@danburzo About performance of multiple HOC’s. There are attempts to combine multiple HOC’s into one HOC automatically by various “recompose” libraries