Im trying to map my state , but it allways returns me this error, someone knows how to solve it ?
const FormScreen = async({route}) => {
const [userForm, setuserForm] = useState([]);
const mounted = useRef(true);
useEffect(async() => {
let mounted = true;
if (mounted && userForm.length > 0 ){
console.log(userForm,'campos:',userForm.fields);
return;
}
else {
setuserForm(await JSON.parse(route.params.paramKey));
}
return () => (mounted = false);
}, [userForm]);
return (
<SafeAreaView style={{flex: 1}}>
<View style={styles.container}>
<Text style={styles.textStyle}>
COLLECTION :
</Text>
{
userForm.length > 0 ? (
userForm.map(async(item) => (
<Text keys={await item.fields.toString()}>testtt</Text>
))
): <Text> Loading ...</Text>}
</View>
</SafeAreaView>
);
};
what I’m trying to do is render all my fields and then handle the following types.