Answer the question
In order to leave comments, you need to log in
How can I make it so that only one paragraph is visible depending on the selection?
Given a select and 3 paragraphs. You can select one of three items in the select. You need to make sure that one of the three paragraphs is visible on the screen, depending on the selection.
state = {
value: 0,
options: [ '1', '2', '3' ],
}
render() {
const { value, options } = this.state;
return (
<div>
<select>
{options.map((n, i) => <option value={i}>{n}</option>)}
</select>
<br />
<p style={{opacity: 0}}>1 text</p>
<p style={{opacity: 0}}>2 text</p>
<p style={{opacity: 0}}>3 text</p>
</div>
);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question