react-collapse-transition
v0.0.2
Published
CollapseTransition component for React
Downloads
21
Maintainers
Readme
CollapseTransition
React collapse transition componnet.
Install
npm i react-collapse-transition
Usage
import React, { Component } from 'react'
import CollapseTransition from 'react-collapse-transition'
class Demo extends Component {
state = {
visible: true
}
toggle = () => {
this.setState(state => {
state.visible = !state.visible
return state
})
}
render() {
return (
<div className="menu">
<p className="menu-title" onClick={this.toggle}>
title
</p>
<CollapseTransition visible={this.state.visible}>
<div className="menu-content">
<p>content...</p>
<p>content...</p>
<p>content...</p>
<p>content...</p>
<p>content...</p>
</div>
</CollapseTransition>
</div>
)
}
}
The result would be like:
LICENSE
MIT