[FEATURE] motion component should be a constructor
See original GitHub issueProblem
When using libraries that have components, I want to make that component inherit the motion.element
props.
When it’s my own component, the motion.element isn’t a problem because I can add any classes but how can I make a component called <Dropdown />
Inherit motion props?
I can’t simply wrap it around a motion component because it can throw the styling off.
Solution
If we make the motion export also be a constructor that can allow me to create a new component that can be animated like so:
const MotionDropdown = motion(Dropdown);
Other libraries
Currently react-spring
has this functionality with their animated component.
https://www.react-spring.io/docs/hooks/basics
const AnimatedDonut = animated(donut);
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9
Top Results From Across the Web
How to pass component constructor in React props?
you can pass component functions as props. You almost got the answer. const Lunch = (props) => { return ( // React.createElement(props.
Read more >Render Props - React
A component with a render prop takes a function that returns a React element and calls it instead of implementing its own render...
Read more >Component Replication | Unreal Engine Documentation
To make a component replicate, simply call AActorComponent::SetIsReplicated(true) . If your component is a default subobject, this should be done in the class ......
Read more >Custom View Components | Android Developers
You can supply a constructor which can take attributes and parameters from the XML, and you can also consume your own such attributes...
Read more >Stateful vs. Stateless Functional Components in React - Code
Its scope is limited to the current component. A component can initialize its state and update it whenever necessary. The state of 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 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
Yeah but this is a method on
motion
, not a prop.Yes, it’s not on the docs, I searched it for a while with no luck but glad I could find this issue.