Message from JavaScript discussions

July 2018

— 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

Message permanent page


Can anyone suggest me a optimized of converting json to array object. I am using [jsonObject] like for conversion?

— Uhm

— Wat

— You want to wrap an object in an array?

— Why?

— Coz the map function will take an array and I am receiving a json object

— Use the callback to map instead?

— Instead of:
Just do:

— Is your json already an array of objects? Then u can just do

JSON.parse(JSON.stringify(json)).map((obj) => console.log(obj));

Message permanent page

— Why stringify and parse?

— Parse should be enough but I mostly use stringify also. Works safer for me that way