Created
August 3, 2020 04:32
-
-
Save asakiran13/4eba50a25fd35d1d1a65e369d798d8f4 to your computer and use it in GitHub Desktop.
This file contains 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
import React, {useState} from 'react'; | |
function ColorsRenderer(props) { | |
const[color, setColor] = useState(props.value); | |
const onColorChange = (event) => { | |
props.onColorChange(event.target.value); | |
setColor(event.target.value); | |
} | |
return( | |
<div> | |
<select value={color} onChange={onColorChange}> | |
<option value="red"> red </option> | |
<option value="black"> black </option> | |
<option value="green"> green </option> | |
<option value="yellow"> yellow </option> | |
<option value="violet"> violet </option> | |
</select> | |
</div> | |
) | |
} | |
export default ColorsRenderer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment