JSFiddle - React, Tailwind, and code Playground
by irinablue
JavaScript
const state = {
rule: {
"title": "",
"priority": 1,
"rocks": 1,
"competitors": [],
"competitor_step": null,
"min_margin": null,
"lower_limit": null,
"upper_limit": null,
"environment": [],
"projects": [],
"brands": [],
"generics": [],
"articles": [],
"strategyType": 1,
}
};
const json = JSON.stringify(state.rule);
const obj = JSON.parse(json);
const ppp = {...state.rule};
state.rule.title = '12345';
console.log('ppp', ppp);
//console.log('json', json);
console.log('obj', obj);
//console.log('state', state);