Feature Request: useComponent Hook
See original GitHub issueI would like to propose a feature to be implemented in react based on this library https://github.com/myckhel/react-use-component
The react-use-component
was created to limit the use of memoised callback hooks and to create Object Oriented
functional Components
.
I would like the react team to look into the concept of this API
and consider its benefits to the amazing React
framework.
Thanks for your review.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Hooks at a Glance - React
Hooks are functions that let you “hook into” React state and lifecycle features from function components. Hooks don't work inside classes — they...
Read more >Lifecycle hooks - Angular
Your application can use lifecycle hook methods to tap into key events in the lifecycle of a component or ... Use component and...
Read more >A Simple Explanation of React.useEffect() - Dmitri Pavlutin
useEffect() hook executes side-effects in React components. ... Examples of side-effects are fetch requests, manipulating DOM directly, ...
Read more >How to use componentWillMount() in React Hooks?
And with Hooks you can only use in functional components. The line below comes from ... Network requests can be done in componentDidMount....
Read more >From class components to React Hooks - CircleCI
Writing and automating tests for React Hooks. Starting with version 16.8, React provides a way to use component and global state without the ......
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 Free
Top 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
Most of us are not using
React Class Component
because we want to make use of React Hooks by usingfunctional components
.Since i prefer using functional components
This approach will give me:
ability to make my functional components object Oriented as if im using a Class Component
ability to not use
useCallback
,useMemo
since you you can pass prop variables to child components by reference rather than valueIt seems the proposal is to have a hook similar to the React class component model.
The purpose of the hooks was to solve these problems.
https://reactjs.org/docs/hooks-intro.html#its-hard-to-reuse-stateful-logic-between-components
https://dev.to/dan_abramov/making-sense-of-react-hooks-2eib
The
useComponent
proposal does not seem to fit the problem the hooks was intended to solve.