A custom react hook to create a status of react component animation.
And a custom Modal component based on useAnimation
hook.
基于react-hooks实现的自定义css动画hook: useAnimation
。以及基于useAnimation
实现的带进入和离开动画的Modal
组件。
Preview:
wait to complete. (codesandbox.com)
Code:
源码(source code):/hooks/use-animation.js
用例(usage):/components/modal/index.js
Note that:
This hook is based on at least react@16.7.0-alpha.
This component style is based onpostcss-preset-env
.
- 本hook至少基于react@16.7.0-alpha版本,也就是需要支持react-hooks的版本。
- 本Modal组件的样式基于
postcss-preset-env
插件。