Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setFixtureState(fixtureState => {
const fsProps = findFixtureStateProps(fixtureState, elementId);
if (!fsProps) {
console.warn(`Element id ${elementId} no longer exists`);
return fixtureState;
}
const { values } = fsProps;
return {
...fixtureState,
props: updateFixtureStateProps({
fixtureState,
elementId,
values: replaceOrAddItem(values, propVal => propVal.key === key, {
serializable: true,
key,
stringified: value
})
})
};
});
};
setFixtureState(prevFs => {
const fsProps = findFixtureStateProps(prevFs, elementId);
if (!fsProps) {
console.warn(`Element id ${elementId} no longer exists`);
return prevFs;
}
return {
...prevFs,
props: updateFixtureStateProps({
fixtureState: prevFs,
elementId,
values
})
};
});
};
setFixtureState(prevFs => ({
...prevFs,
props: updateFixtureStateProps({
fixtureState,
elementId,
values: createValues(childEl.props)
})
}));
}