I'm working in a React component that must implement a <select><option>
functionality.
I have this:
<div className="input-field col s12">
<select>
<option value="" disabled>Choose your option</option>
{projects.map(function(projects, index) {
return (
<option value={projects.name} key={projects.name}>
{projects.name}
</option>
)})}
</select>
<label>Project</label>
</div>
I also have the materialize select initialized in componentDidMount():
componentDidMount: function() {
//initialize selects
$(document).ready(function() {
$('select').material_select();
});
},
(...)
But when the component is displayed, it appears without <options>. When debugging the generated html in the web source code with inspection tool it has the options with display none, but when changing to block, it creates a new select after it, with no style.
Any ideas? Thanks so much.
returnin the middle of jsx like that.. looks like you're missingmap?