I am using react native paper. But I have some trouble with setting the title with my variables. Any help is appreciated.
As stated in their doc Text for the title. Note that this will only accept a string or <Text>-based node.
but I am not sure how to insert -based nodes
https://callstack.github.io/react-native-paper/docs/components/Card/CardTitle
<Card.Title
title={
<Text>
Top {sites.length} Sights in {country.name}
</Text>
}
/>
But i get the following error
Text' cannot be used as a JSX component.
Its instance type 'Text' is not a valid JSX element.
Type 'Text' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.
2
Answers
here:
The error appeares because title prop is expecting a text not JSX. To use variable title you can use this code