Reputation: 463
I am trying to create a very simple input screen containing inputs, labels and a picker.
The app that I am trying to build contain a picker, two numeric inputs and two labels (existing side by side along with the input elements) as shown below
When the user makes a selection in the picker (can choose either "Metric" or "Imperial"), the labels (B1 & B2) beside the inputs should also change accordingly as {B1: "Kg", B2: "Cm"} or {B1: "Inches", B2: "Lbs"}
What are some design pattern/strategies to achieve this ?.
Looks like a simple problem but I have run out of ideas as to how change the label based on the selection of picker.
I have thought of creating two different Modals M1 and M2 with visibility toggling but I am not sure that the solution is elegant :(
Would appreciate any tips or guidelines as to how this problem (changing a label based on picker selection) is solved.
Upvotes: 0
Views: 358
Reputation: 469
I strongly advise you to try creating code yourself first by following the react documentation.
These are some steps to help you get started:
A change in state will re-render components so the label will change automatically.
Upvotes: 1