Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Why one would pass a function to a react component to obtain the data instead of data itself?

$
0
0

I have a question, that might be subtle (or not).

Why one would pass a function to a react component to obtain the data instead of data itself?A short example would be

<CompTest data={data} ...> 

vs

const getData() => data;<CompTest data={()=> getData()} ...> 

I am wondering if there is a trick with the react data pulling it with laziness ... not sure..


Viewing all articles
Browse latest Browse all 6287

Trending Articles