I am working on an expo app. I got a situation which my component/data disappear after page refresh, but when I make any kind of changes in my code(such as just adding semicolon) and click save, component/data shows up, then once again, while I click refresh, component/data disappear.
The situation is very similar to the page React component content disappears after page refresh, which state return [] after refresh. I have tried all the methods in the page, but none of them work in my case.
const [Final, setFinal] = useState([]);
const [Sign, setSign] = useState([[);
const [Linedata, SetLinedata] = useState([]);
useEffect(() => {
(async () => {
getSign();
getLine();
setFinal(await getFinal());
})();
}, [])
const getFinal = () => {
// combine sing data and line data
return new Promise((resolve)=>{
const FinalLineData = Sign.map((item, i) => Object.assign({}, item, { Line: Linedata[item['sign']] }))
resolve(FinalLineData)
})