1
I want to click on mine Icon
it changes properties of the first element. Where am I missing? How to do?
import React from 'react';
import './header.css';
import { Col, Container, Row, MediaBox, Icon } from "react-materialize";
class Header extends React.Component {
constructor(props) {
super(props);
this.state = { active: true };
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
this.setState(state => ({
active: !state.active
}));
}
render() {
return (
<Col
s={12}
m={4}
l={2}
className="pink darken-1 text-white header"
thisActive={this.state.active ? 'active' : ''}>
<Container>
<Row>
<Col s={6} m={4} l={2} className="header-logo">
<MediaBox className="header-logo-img">
<img src={require("./img/logo-insta-header.png")} />
</MediaBox>
</Col>
<Col s={6} m={4} l={2} className="header-menu">
<Icon medium right className="header-menu-btn text-white" onClick={this.handleClick}>
menu
</Icon>
</Col>
</Row>
</Container>
</Col>
);
}
}
export default Header;
And that would be the "first element" to div
header-menu
?? You think a pure JS code could help you or has to be in React even?– hugocsl
The first element would be . header and a pure js code could help yes.
– Rafael Pessoa
OK Rafael I left an answer, I tried to follow to the maximum the structure you have, in fact I think it looked good and it will be easy for you to adapt the JS pro React ;)
– hugocsl