简体   繁体   中英

Issue animating react components using framer motion on state change

Im having some issues getting an animation to work using framer motion. Any help would be greatly appriciated.

Code Sandbox Example

You went a bit too far trying to use custom properties here. Simple ternary conditional in animate did the trick.

Also, you had a bug in your increment decrement function, I fixed it too.

Check my solution here: https://codesandbox.io/s/framer-motion-issue-forked-6no3o?file=/src/App.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM