Use defaultValue

This commit is contained in:
Chris Blanchard 2015-09-15 17:11:52 +01:00
parent b7aaa08e4b
commit f12b19a90f

View file

@ -142,18 +142,17 @@ var ProfileModal = React.createClass({
let division = this.props.user.profile.skill; let division = this.props.user.profile.skill;
let skillLevels = ["Low Skill", "Medium Skill", "High Skill"].map(skill => { let skillLevels = ["Low Skill", "Medium Skill", "High Skill"].map(skill => {
if (skill === division) { return <option key={skill}>{skill}</option>
return <option selected="selected" key={skill}>{skill}</option>
} else {
return <option key={skill}>{skill}</option>
}
}); });
return ( return (
<form> <form>
<div className="form-group"> <div className="form-group">
<label>Player Skill</label><br /> <label>Player Skill</label><br />
<select className="form-control" ref="playerskill"> <select
defaultValue={division}
className="form-control"
ref="playerskill">
{skillLevels} {skillLevels}
</select> </select>
<p><small>Try to give an accurate representation of your skill to raise the quality of your gathers</small></p> <p><small>Try to give an accurate representation of your skill to raise the quality of your gathers</small></p>