I am new to React-Redux, I've created a ReactJS project and I am trying to convert my project to React-Redux. I won't understand how it is possible.
If anyone has any idea please suggest me.
Here is my project code
import React, { Component } from 'react';
import './accordion.css';
class Accordion extends Component {
state = { active: '', height: '0px' };
content = React.createRef();
toggleAccordion = () => {
this.setState({
active: this.state.active === '' ? "active" : "non-active",
height: this.state.active === 'active' ? "0px" : `${this.content.current.scrollHeight}px`,
})
console.log(this.content)
}
render() {
return(
<div>
<button className={`accordion ${this.state.active}`} onClick={this.toggleAccordion}>
{this.props.title}
</button>
<div className="panel" ref={this.content} style={{maxHeight: `${this.state.height}`}}>
{this.props.content}
</div>
</div>
);
}
}
export default Accordion;
Here is my sandbox