const [merchantServicesList, setMerchantServicesList] = useState([]);
const convertSelectedDataToArr =
selectedData &&
Object.keys(selectedData)
.map(i => selectedData[i])
.filter(m => m.selected);
const convertSelectedDataToArrId = convertSelectedDataToArr &&
convertSelectedDataToArr.map(s => s.id);
useEffect(() => {
const handleData = () => {
if (convertSelectedDataToArr) {
saveFunc('1234', convertSelectedDataToArrId);
setMerchantServicesList([...convertSelectedDataToArr]);
}
};
handleData();
}, [selectedData]);
return merchantServicesList;