Last active
December 1, 2018 21:13
-
-
Save schnerd/045ee729696f0352bb106b186eb50855 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// App.js | |
render() { | |
<Autocomplete | |
options={this.props.products} | |
overrides={{ | |
Root: { | |
props: {'aria-label': 'Select an option'}, | |
style: ({$isOpen}) => ({borderColor: $isOpen ? 'blue' : 'grey'}), | |
}, | |
Option: { | |
component: CustomOption | |
} | |
}} | |
/> | |
} | |
// CustomOption.js | |
export default function CustomOption({onClick, $option}) { | |
return ( | |
<div onClick={onClick}> | |
<h4>{$option.name}</h4> | |
<small>{$option.price}</small> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment