showing results for - "reactjs classlist remove"
Hannes
03 Apr 2017
1import React, { Component } from 'react';
2
3class Arrow extends Component {
4
5  constructor(props) {
6    super(props)
7
8    this.state = {
9      status: false
10    }
11  }
12
13  toggleArrow = function() {
14    if(this.state.status) {
15      //closes it
16      document.getElementById('arrow').classlist.remove('arrow-closed');
17
18    } else {
19      //open
20      document.getElementById('arrow').classlist.add('arrow-closed');
21    }
22
23    this.setState({ status: !this.state.status })
24  }.bind(this);
25
26  render() {
27        return (
28            <a id="arrow" onClick={() => this.toggleArrow()}className={`${this.props.className} arrow`}></a>
29        )
30    }
31}
32
33export default Arrow;
34