score:1
i think you should slightly change the approach to a better toggle. try this
const [showhiddenbanner, setshowhiddenbanner] = usestate(true);
<img onclick={() => showhiddenbanner(!showhiddenbanner} src={hamberger} alt="hamberger" classname="hamberger" style={{ cursor: "pointer" }} />
then in your code you can do this
{ showhiddenbanner ? <hiddenbanner /> : <displaysomethingelse />
Source: stackoverflow.com
Related Query
- React onClick function not executing when DEPLOYED
- React onClick event not firing when function is passed to child
- State not updating when executing onChange function in React
- React onClick function for list items not receiving value when child clicked
- TypeError dispatcher.useState is not a function when using React Hooks
- onclick function is not working in react native application
- React JS : history.push is not a function error and it isn't navigating to a different page onclick of swal
- _this.store.getState is not a function when testing react component with enzyme and mocha
- Why react calls function in subcomponents event when this subsomponents not rendered?
- onClick function in React not working?
- Invariant Violation: Objects are not valid as a React child when firing a function
- Razzle react not loading proper bundle when deployed
- Getting TypeError: Object(...) is not a function with when changing Routes in React
- 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 Hooks state not working properly when the function calling it is called in another function
- React Router not functional when deployed in a sub-directory On Apache
- When Using Redux Saga with React Get This Error .. Uncaught TypeError: getPosts is not a function
- OnClick not working when rendering React button on a custom dialog
- Component not mounted when setState called in arrow function in React with ES2016
- 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 function not working inside a flexbox
- MobX, React Router v4, Route using render function not observing and re-rendering when store changes
- onClick event handler not work as expected when attached to SVG Icon in React
- React not rerendering props when render function is provided
- react onClick not triggering function
- React throws an error "Can't assign to property" scrollLeft "on 1: not an object" When trying use ref in custom function
- React form onSubmit and onClick do not fire when inside Zurb Foundation "Reveal" dialog
- 404 Not Found error in preflight OPTIONS when executing a PUT method in CakePHP API with axios in React App
More Query from same tag
- Ternary operator doesn't work as expected
- React - Target container is not a DOM element
- docker-compose, failed to solve: rpc error: code = Unknown desc = failed to compute cache key: "/app/package.json" not found: not found
- unable to get table item in deleted section
- Redirect after completing an action with react-router-dom V5.+
- I would like to use TypeScript and React in Laravel Project
- org-reveal customization of title slide
- scroll to bottom/row on react-virtualized with autosizer and cellmeasurer
- ReactJs + Redux : how to do blockUI easy just like jQuery BlockUi?
- How to alter deeply nested children?
- Sentry/Raven on an Electron React app - what am i doing wrong?
- Param Redux data not populating in store correctly
- React redux props undefined
- Why does my HTML not display when I iterate through the populated array?
- How to mock store in redux toolkit
- Using a higher order component with multiple Draft.js editors in single page
- react-spring how to use animated(Component)
- Render loading screen while waiting for DOM to render after update
- How to send requests from nginx & react container to a spring boot container?
- now.getTime() inside useEffect doesn't work
- Why i get hashed .jpeg file when running 'npm run build' with webpack
- Adding breakpoint to custom theme in Material UI Next (reactjs)
- Is there a way to click div container wrapped react-router Link component?
- Problem with use of Axios mock adapter GET
- React.js: Difference between passing in the subcomponents with React.render() and with React.createClass()'s render?
- Hosting multiple React apps with one S3 bucket
- req.files is undefined using express-fileupload
- Do an API call every few seconds using the Context API and React Hooks
- react-router: Not found (404) for dynamic content?
- Data fetched from an API is not rendering (React)