A JavaScript utility library delivering consistency, modularity, performance, & extras.
Hello, I am putting my data into the state with cloneDeep as below. However, when the props change, the state does not change.
How should I proceed?
state = cloneDeep (this.props.modelData);
Hello, please tell me what can be done in my case? (Angular)
I have a model with a lot of elements and every time I call cloneDeep, the processing time of the model (almost doubles) is increased, although the model does not change significantly.
In this case, there is a page component that contains a list of tabs. In each tab, a complex component is generated. When I click on the tab, ngOnInit is called with cloneDeep for the model based on which the component is rendered
ctx.selectedPlayers.forEach((player) => {
const comparableMatches = player.matches.map((match) => ({
teamName: match.teamName,
matchId: match.matchId,
eloDiff: match.eloDiff,
map: match.map,
win: match.win,
time: new Date(match.time),
}));
allMatches.push(comparableMatches);
});
return _.intersectionWith(...allMatches, _.isEqual);
(object1, object2) => boolean