import React from 'react'; import style from './menu.css'; class Menu extends React.Component { constructor(props) { super(props); const classNames = ['', '']; classNames[props.active] = 'active'; this.state = { active: classNames, }; } render() { return ( <div> <ul> <li> <a href="index.html" className={this.state.active[0]}>Have</a> </li> <li> <a href="want.html" className={this.state.active[1]}>Want</a> </li> </ul> </div> ); } } export default Menu;