Answer the question
In order to leave comments, you need to log in
How to change select value by condition?
There is a select form in React, it has several {option1, option2, option3........}
Option elements loaded from a file with such an array:
export default {
"option1": {
name: "option1",
fields: some text
},
"option2": {
name: "option2",
fields: [{some obj}]
},
"option3": {
name: "option3",
fields: some text,
some func(){},
},
"option4": {
name: "option4",
fields: [],
}
}
if (window.location.search === "?advanced_mode")
{show option4};
Answer the question
In order to leave comments, you need to log in
Something like this:
https://codesandbox.io/s/mq7m3wxo3x
https://mq7m3wxo3x.codesandbox.io/?advanced_mode
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question