Show/Hide components in ReactJS

后端 未结 2 371
傲寒
傲寒 2020-12-01 02:27

We have been experiencing some problems in using react now but it kinda boils to one part of how we have been using react.

How should we have been showing/h

2条回答
  •  余生分开走
    2020-12-01 02:29

        /* eslint-disable jsx-a11y/img-has-alt,class-methods-use-this */
    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import todoStyle from 'src/style/todo-style.scss';
    import { Router, Route, hashHistory as history } from 'react-router';
    import Myaccount from 'src/components/myaccount.jsx';
    
    export default class Headermenu extends Component {
    
      constructor(){
      super();
    
      // Initial state
      this.state = { open: false };
    
    }
    
    toggle() {
      this.setState({
        open: !this.state.open
      });
    }
    
      componentdidMount() {
        this.menuclickevent = this.menuclickevent.bind(this);
        this.collapse = this.collapse.bind(this);
        this.myaccount = this.myaccount.bind(this);
        this.logout = this.logout.bind(this);
      }
    
      render() {
        return (
          
    ); } menuclickevent() { const listmenu = document.getElementById('listmenu'); listmenu.style.display = 'block'; } logout() { console.log('Logout'); } myaccount() { history.push('/myaccount'); window.location.reload(); } }

提交回复
热议问题