I am using Typescript with React Native and I am having trouble with an error on the console. It says "This expression is not callable. Type 'Boolean' has no call signatures."The code is simple, it just has two cards in the home page and if the user clicks one of them, it should send the user to that page. I tried to achieve that trough useState in order to understand better the hook. This is the code in home.tsx:
import { Button, StyleSheet, Text, View } from "react-native"import CardsComponent from "../../components/cards/cards"import EcoNoticias from "../../components/EcoNoticias/EcoNoticias";import React from "react";import { useState } from "react";export interface HomeComponentProps {}const HomeComponent: React.FC<HomeComponentProps> = () => { const [buttonPressed, setButtonPressed] = useState<boolean>(false); const handlePage = () => { setButtonPressed(true); }; return (<><View><Text style={styles.title}>Hello User</Text><View> {() => buttonPressed(false)} ?<CardsComponent><Text style={styles.textCard}>Tips</Text><Button title='Tips' onPress={() => {}} /></CardsComponent><CardsComponent><Text style={styles.textCard}>Eco-Noticias</Text><Button title='Eco-Noticias' onPress={handlePage} /></CardsComponent> : <EcoNoticias /></View></View></> );};const styles = StyleSheet.create({ title: { fontSize: 23, paddingBottom: 50, textAlign: 'center', }, textCard: { color: 'white', fontWeight: '700', textAlign: 'center', paddingBottom: 10, }, buttonStyle: { width: '50%', },});export default HomeComponent;
The error it's in the if ternario, line 24: "buttonPressed(false)".