Comments (8)
Seems to have been added to the readme already:
<a onClick={() => go(1)}>
from react-morph.
Hi @beepcode, sorry for not clear. I mean using in userβs own function like the handleGo in the above code.
from react-morph.
Ok, the simplest solution would be to pass the go() function as a parameter. This would look like so:
handleGo = (go) => { go(); }
...
<a onClick={() => this.handleGo(go)}>
from react-morph.
Thanks, @beepcode , that is what I thought.
But <a onClick={() => this.handleGo(go)}>
will causing rerender, right?
If it is, maybe the author can export something like below to help avoid rerender?
import { morphGo } from "react-morph";
handleGo = () => {
morphGo();
// something else
}
from react-morph.
You could use the lifecycle method "shouldComponentUpdate()" to prevent rerender.
from react-morph.
Thanks, I get it.
Hope the package can handle those things. Better experience for the rest of people.
from react-morph.
What are you trying to achieve exactly? Which "business case" are you trying to find a solution to? From my perspective the sole purpose of "go()" is to start the morph, so rerender is expected. Or are you trying to trigger the morph from outside?
from react-morph.
Oh, you are right! I forget rerender is necessary in this case for the animation. My bad.
from react-morph.
Related Issues (18)
- SSR error
- Resizing the window breaks the morph animation HOT 1
- PropType error HOT 4
- Real life examples HOT 1
- Declarative API
- Dependency issue HOT 2
- Error Compiling
- Support for React Portals in the second state
- Avoid animating itself
- Images resizing only works when changing routes
- How to create useMorph instances dynamically and share them (useMorphId?) HOT 1
- Apple App Store example not working. HOT 3
- After importing useMorph I get an error (2,29): Cannot find module './types'.
- Sandbox links
- text transition ends a bit jumpy/abrupt
- Morphing wrapped with flex HOT 1
- license ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-morph.