I have the following in one of my React / Gatsby files:
import React from react
const click = () => {
console.log(J);
}
const NavButton = () =>
<button className=navbar-toggler navbar-toggler-right style={{backgroundColor: 'blue', position: absolute, margin: 30px}}type=button data-toggle=collapse data-target=#collapsingNavbar onClick={click}>
<div id=nav-icon1>
<span></span>
<span></span>
<span></span>
</div>
</button>
const Dropdown = () =>
<div style={{visibility: hidden, backgroundColor: blue, position: absolute, height: 100%, width: 100%}}>
</div>
export default (props) =>
<div className=left col-xs-12 col-md-6>
<Dropdown />
<NavButton />
{props.children}
</div>
Now I would like to fire click()
whenever somebody presses the NavButton
, and then I would like to make Dropdown
visible. How would I do this? Right now I have it hardcoded that Dropdown
has style={{visibility: hidden, ...
.
I'm also wondering whether I am doing this correctly, having everything loosely in these different functions, if somebody could tell me that would be great!