Below is the call to the api and the console.log
returns what I want, but I want to return the result in the <Text>{callOnmoTermsApi}</Text>
The error I am getting is
Warning: Functions are not valid as a React child.
When I change the Text to a Button and console.log the onPress action it also shows what I want! Please help!!!
import { NavigationState } from '@react-navigation/routers';import React, { useState } from 'react';import { SafeAreaView, Text } from 'react-native';import { NavigationParams, NavigationSwitchProp } from 'react-navigation';import { onmoTerms } from '@/api/authApi';import OnmoButton from '@/components/Buttons/OnmoButton';interface Props { navigation: NavigationSwitchProp<NavigationState, NavigationParams>;}const OnmoTermsAndCond = () => { const [terms] = useState(''); const callOnmoTermsApi = () => { onmoTerms() .then((resp: any) => { if (resp.statusCode === 200) { console.log('terms ', resp); } setTimeout(() => { console.log('timeout terms ', resp); }, 500); }) .catch((error) => { console.log(error); }); }; return (<SafeAreaView><Text>{callOnmoTermsApi}</Text></SafeAreaView> );};export default OnmoTermsAndCond;