The following is my component where the props data getting updated when the searchItem() has been executed. I can't understand why this is happening. How can I fix this issue?
const DefaultTabGroup = ({data}) => {
const [res , setRes] = useState({});
useEffect(() =>{
setRes(data);
},[data]);
const searchItem = () =>{
let transData = [];
res.map((d) =>{
let a = d;
a.connectors = [];
transData.push(a);
});
};
//code.....
}
export default DefaultTabGroup;