— I have a form with multiple inputs each input subscribes the store and onChange updates the state which then gets saved in the localStorage. Every input is controlled and gets the value from the state. Problem when I type something in the form every input rerenders
Can anyone suggest me a optimized of converting json to array object. I am using [jsonObject] like for conversion?
— You want to wrap an object in an array?
— Coz the map function will take an array and I am receiving a json object
— Use the callback to map instead?
— Instead of:
— Is your json already an array of objects? Then u can just do
JSON.parse(JSON.stringify(json)).map((obj) => console.log(obj));
— Why stringify and parse?
— Parse should be enough but I mostly use stringify also. Works safer for me that way