Skip to content

Repository files navigation

react-flash-change

Flash container on change props

NPM registryNPM license

Demo

Here is an examples page.

There are sources in ./storybook

Install

# Yarn
yarn add @avinlab/react-flash-change
# NPM
npm install --save @avinlab/react-flash-change

Usage

importReactfrom'react';importFlashChangefrom'@avinlab/react-flash-change';constComponent=({ value })=>{<FlashChangevalue={value}flashClassName="flashing"compare={(prevProps,nextProps)=>{returnnextProps.value!==prevProps.value;}}><span>{value}</span></FlashChange>;};

API

Props

PropertyTypeRequired?Description
compareFunctionFunction to compare props before and after update to resolve to flash or not. Function params: (prevProps, nextProps). Default it compares props.value. If return string - it will be flash className.
flashDurationNumberDuration of "flash"-effect in ms. Default: 200ms
flashClassNameStringFlash-effect className
flashStyleObjectFlash-effect style object
classNamestringOptional custom CSS class name
styleObjectOptional inline style
outerElementTypeReact$ElementTypeTag name passed to document.createElement to create the outer container element. Default: div

License

MIT © avin

About

Flash container on change props

Topics

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages