Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
that.resetDefaultState = () => {
that.setState({
...Object.keys(that.state).reduce((acc, key) => {
acc[key] = false;
return acc;
}, {}),
...defaultState
});
setCurrentParamsOnUrl({}, that.props.history.replace);
// localStorage.editorDemoState = JSON.stringify(defaultState);
};
}
export function setParamsIfNecessary({ that, defaultState }) {
if (!isEqual(that.state, that.oldState)) {
setCurrentParamsOnUrl(
difference(that.state, defaultState),
that.props.history.replace
);
that.oldState = cloneDeep(that.state);
}
}