selected item in select
I'm using Etch to build a plugin and I have a select. I've try to use "React style" of having <select value={this.state.myval} but it does not seem to work.
I've end up running the following line after etch.initialize(this):
this.refs.myselect.value = this.state.myval
Do you have a recommended way of selecting an item in a select.
I haven't actually tried to use a select myself yet. The virtual-dom library used by etch assigns properties to the DOM nodes based on the JSX attributes, so I'm surprised that assigning the value property manually gives you a different behavior. Basically, this should work. Can you fiddle with it a bit more and if it still doesn't I'll try adding a case to the test suite to figure out what's going on.
Looks like this is actually a problem in virtual-dom https://github.com/Matt-Esch/virtual-dom/issues/115 & https://github.com/Matt-Esch/virtual-dom/issues/195
My solution is to set the selected on the option like it is mentioned in both of them.