score:1
Accepted answer
you are not doing anything with the passed onclick event. you need to put it on something, like so:
const sidebar = (props) => (
<div onclick={this.props.onclick} classname={classes.sidebar}>
<logo />
<nav>
<navigationitems />
</nav>
</div>
);
export default sidebar;
this will fire that event when you click on the div. make sense?
Source: stackoverflow.com
Related Query
- onClick not invoked when clicking on sidebar
- onClick not firing when clicking on component
- ReactJS: onClick handler not firing when placed on a child component
- React Router work on reload, but not when clicking on a link
- React onClick event not firing when function is passed to child
- react-modal not closing when clicking the overlay
- Javascript onClick not firing when assigned inside of array.map
- How to change URLs (but not entire view) when clicking on a modal with Material-ui and react-router 4?
- useState not rerendering when update function is called inside onClick function
- onClick event not passing a function when placed in a forEach loop in ReactJS
- React - render component when clicking on a component which is not its child
- OnClick not working when rendering React button on a custom dialog
- react-router 4 not re-render when clicking <Link>
- stop onClick function in container div from executing when clicking inner element
- Why React component is launching onClick event on render, but not when clicked?
- React onClick event working on twice clicks when clicking again
- onClick event handler not work as expected when attached to SVG Icon in React
- React Router V5 not rendering route when clicking Link, but back and forward buttons work?
- activeClassName does not work on the sideMenu when clicking on the link
- React.js onClick not working clicking span icons mapped from json table
- React form onSubmit and onClick do not fire when inside Zurb Foundation "Reveal" dialog
- Redux mapDispacthToProps - prop not invoked when called from unload event
- Hide Div onClick when clicking outside the child div | ReactJS
- setting react state when clicking on a functional component via onClick (TypeScript)
- Map function is not working properly when I hit onClick
- Why does setting state in child component onclick cause recursive loop even when button not clicked?
- Radio buttons do not check when clicking the label
- Animation is not applied when hovering sidebar
- Function does not re-render when clicking button
- React is not rendering the information when onClick event
More Query from same tag
- State is unchanged from within a function returned by a hook
- Parsing nested json in Reactjs
- Why is TinyMCE displaying HTML tags?
- Extract URL Query String ES6
- How to set focus on rendering redux form dynamically created in loops
- In react, how do I do an if statement
- forEach() does not update the values inside a database call
- TypeError: eleves.map is not a function React/Spring-boot cannot display @ManyToOne relation
- React Array to Object conversion
- How to clean up promise data in react hook?
- How to add sass-loader with Webpack 1?
- How can loop through array of JSON Object to find property value that includes user input characters
- setState not working inside axios fetch
- How to properly configure Next.js as a frontend and Express app as a backend?
- Is it possible to put in order React useEffects?
- ReactJS + Material-UI: How to use Material-UI’s FlatButton and Dialog in each TableRow?
- ReactJS - Can I open open a Modal from different component
- Pass function from parent to children in React.Children.map?
- Can't get the value passed in any way to the entry index.js
- How can I add object in array as value length?
- Using create-react-app hosted on S3 to hit a Heroku API
- How can I convert Redux toolkit reducers In react
- Correct syntax for props in SVG in jsx
- How to import bootstrap and fontasome in index.html reactjs app
- How can I request the value I get from the user to the backend api using react?
- (next 10) - next-pwa does not work when add the basePath to next.config.js
- React: Passing props between components is always undefined - Context API
- Calculation in React based on input and back-end
- onPreview not working when click to previewIcon - Antd
- React update setState convert String to Array