I'm fetching data from api and then i want to show images based on the symbol coming from the api data
{apiData ? (
apiData.data.map((item, key) => (
<Listing symbol={item.symbol} path={`../images/${item.symbol}.png`} />
))
) : (
<></>
)}
sending the path and the symbol to another component VVVV
const Listing = ({ symbol, path }) => {
return (
<View style={tw`flex-row justify-between p-10`}>
<View style={tw`flex-row items-center`}>
<Text style={tw`mr-2`}>{symbol}</Text>
<Image source={require(path)} style={{ width: 50, height: 50 }} />
<Text>{path}</Text>
</View>
</View>
);
};
Is there a way to do it like that or i have to use something else ?