###### Value is passed by refernce and not by value even in the hooks i.e usestate ######## The problem can be solved by setting the value using the follow. setvariable(JSON.parse(JSON.stringify(props.variable)));