All Projects → unirakun → hoc-react-animate

unirakun / hoc-react-animate

Licence: MIT license
Add a CSS class whenever a props change (or/and at mount)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to hoc-react-animate

Rx React Container
Use RxJS in React components, via HOC or Hook
Stars: ✭ 105 (+650%)
Mutual labels:  hoc
Redux Auth Wrapper
A React Higher Order Component (HOC) for handling Authentication and Authorization with Routing and Redux
Stars: ✭ 2,175 (+15435.71%)
Mutual labels:  hoc
rrx
⚛️ Minimal React router using higher order components
Stars: ✭ 69 (+392.86%)
Mutual labels:  hoc
React Onclickoutside
An onClickOutside wrapper for React components
Stars: ✭ 1,736 (+12300%)
Mutual labels:  hoc
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (+1135.71%)
Mutual labels:  hoc
Next Ga
Next.js HOC to integrate Google Analytics on every page change
Stars: ✭ 228 (+1528.57%)
Mutual labels:  hoc
Flagged
Feature Flags for React made easy with hooks, HOC and Render Props
Stars: ✭ 97 (+592.86%)
Mutual labels:  hoc
nextjs-redirect
HOC to redirect to any URL in NextJS both in client and server
Stars: ✭ 144 (+928.57%)
Mutual labels:  hoc
React With Direction
Components to provide and consume RTL or LTR direction in React
Stars: ✭ 176 (+1157.14%)
Mutual labels:  hoc
vue-animate-onscroll
A simple component that animates elements as they scroll into view.
Stars: ✭ 89 (+535.71%)
Mutual labels:  animate
Next Nprogress
Next.js HOC to integrate NProgress inside your app
Stars: ✭ 145 (+935.71%)
Mutual labels:  hoc
Neoform
✅ React form state management and validation
Stars: ✭ 162 (+1057.14%)
Mutual labels:  hoc
Escape From Callback Mountain
Example Project & Guide for mastering Promises in Node/JavaScript. Feat. proposed 'Functional River' pattern
Stars: ✭ 249 (+1678.57%)
Mutual labels:  hoc
React Spatial Navigation
HOC-based Spatial Navigation (key navigation) solution for React
Stars: ✭ 128 (+814.29%)
Mutual labels:  hoc
pixi-ease
pixi.js animation library using easing functions
Stars: ✭ 90 (+542.86%)
Mutual labels:  animate
Rnprojectplayground
🍨React Native 相关,涉及 MobX、MST使用,原生简易导航模块、列表组件封装,一些动画尝试,以及 HOC 应用。
Stars: ✭ 100 (+614.29%)
Mutual labels:  hoc
Tubular React
Material UI table with local or remote data-source. Featuring filtering, sorting, free-text search, export to CSV locally, and aggregations.
Stars: ✭ 202 (+1342.86%)
Mutual labels:  hoc
react-table-hoc-draggable-columns
ReactTable HOC for draggable columns
Stars: ✭ 27 (+92.86%)
Mutual labels:  hoc
react-useragent
Higher order component to add user agent information to your react components
Stars: ✭ 13 (-7.14%)
Mutual labels:  hoc
react-app-loader
Production ready library for handling Microfrontends
Stars: ✭ 75 (+435.71%)
Mutual labels:  hoc

hoc-react-animate

what is this?

This is a higher order component ("HOC") that adds a CSS class to its child component whenever a prop change or at mount (or both) to animate it.

try it

You can test some examples here.

install

npm i --save hoc-react-animate

use

You have to wrap your component, and give some informations:

Parameter Required Default value Description
watchedProps no [] The props to watch (they are compared with lodash.isEqual)
timeout no 1000 The time (in ms) for which the CSS class is applied to the wrapped component
className no 'animate' The class to add when a prop changes (or at mount)
atMount no false Set to true if you want to animate the component at mount

Component.js

import React, { PropTypes } from 'react'
import animate from 'hoc-react-animate'

const Component = ({ className, text }) => {
  return (
    <div
      className={`component ${className}`}
    >
      {text}
    </div>
  )
}

Component.propTypes = {
  className: PropTypes.string,
  text: PropTypes.string,
}

export default animate(
  Component,
  {
    watchedProps: ['text'],
    timeout: 200,
  }
)

css

.component {
  transition: all .2s;
}
.component.animate {
  transform: scale(2);
}

About uni rakun

uni rakun is created by two passionate french developers.

Do you want to contact them ? Go to their website

Guillaume CRESPEL Fabien JUIF
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].