I want the selected option to be stored in localstorage, I track it in another select component and convert the received data and add it to localstorage , but I can’t figure out how to implement select and option. I get the data from GraphQl , so let's assume that the option contains the values "one", "two", "three" Thanks
const Currency_Query = gql`
{
currencies{
label
symbol
}
}
`
;
class Currency extends Component {
constructor(props){
super(props);
this.state = {
currencies: [],
}
}
componentDidMount = async () =>{
const response = await client.query({
query: Currency_Query
})
this.setState({
currencies:response.data.currencies
})
}
render() {
return(
<div className={s.select}>
<select>
{this.state.currencies.map((currencies) =>(
<option>
<div className={s.option} >{currencies.symbol} {currencies.label}
</div>
</option>
)
)
}
</select>
</div>
);
}
}
export default Currency;