Skip to content

Instantly share code, notes, and snippets.

@anderjs
Created August 29, 2019 18:37
Show Gist options
  • Save anderjs/d6f4906c8743708b1c35dbcec2bd7b9e to your computer and use it in GitHub Desktop.
Save anderjs/d6f4906c8743708b1c35dbcec2bd7b9e to your computer and use it in GitHub Desktop.
const DepartmentButton = ({ onMouseOver }) => {
<button onMouseOver={onMouseOver}>Example</button>
}
const App = () => {
const [classList, setClassList] = useState('inactive')
function onMouseOverHandler() {
if (!isMobileDevice()) {
setClassList('activo')
}
}
return (
<React.Fragment>
<div className={classList} />
<DepartmentButton onMouseOver={onMouseOverHandler} />
</React.Fragment>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment