Hi everyone,
I need some advice so, I am here. I have a big state in my form component and the person I am working with would like I make it shorter and avoid repetitions (but some of the repetitions are due to using Material Design for Bootstrap framework). He suggests me to do some maps but I can’t imagine how I can do this and it seems a bit strange to me. But maybe I am wrong, as I am just a newbie for now.
In my opinion, I need to break the component in severals components, if I want the component state to be shorter. But, as my form component isn’t working at 100 % at the moment, if I need to do it, I will do it when everything is working.
So here is my big state :
const initState = {
hideIsClicked: false,
isClicked: false,
appEvaluation: true,
appNiveau: true,
appCertification: true,
appExercice: true,
appLangueConsigne: [
{
checked: false,
text: "Japanese",
value: "ja"
},
{
checked: false,
text: "French",
value: "fr"
},
{
checked: false,
text: "English",
value: "en"
}
],
appLangue: [
{
checked: false,
disabled: false,
text: "Japanese",
value: "ja"
},
{
checked: false,
disabled: false,
text: "French",
value: "fr"
},
{
checked: false,
disabled: false,
text: "English",
value: "en"
}
],
appConsigne: "",
questionElements: [
{
id: 0,
questionElement: ""
},
{
id: 1,
questionElement:""
},
{
id: 2,
questionElement:""
}
],
reponseCorrecte: "",
reponses: [
{
id : 0,
reponse: ""
},
{
id : 1,
reponse: ""
},
{
id : 2,
reponse: ""
},
{
id : 3,
reponse: ""
}
],
}
Do others solutions exist to make a state more simple ? What do you think ?