Deepak
Deepak3y ago

Deepak – 07-11 Oct 21

Hello, how can i tweak this ?
const [state1, setState1] = useState({
data: ["a", "b", "c", "d"],
title: "albhabets"
});
const state2 = [{ data: ["e", "f"], title: "albhabets" }];

const merge = () => {
setState1([...state1.data, ...state2.data]);
console.log(state1);
};
const [state1, setState1] = useState({
data: ["a", "b", "c", "d"],
title: "albhabets"
});
const state2 = [{ data: ["e", "f"], title: "albhabets" }];

const merge = () => {
setState1([...state1.data, ...state2.data]);
console.log(state1);
};
https://codesandbox.io/s/busy-currying-ju23ke?file=/src/App.js:103-367
Deepak8717
CodeSandbox
busy-currying-ju23ke - CodeSandbox
busy-currying-ju23ke by Deepak8717 using react, react-dom, react-scripts
1 Reply
reactibot
reactibot3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/1032914018790293524 Question not getting answered? Maybe it's hard to answer, or maybe you asked at a slow time. Check out these resources for help asking a good question: https://stackoverflow.com/help/how-to-ask http://wp.me/p2oIwo-26