简体   繁体   中英

Is there a way to render ReactiveList conditionally

I'm working with ReactiveSearch and trying to figure out how I can render a ReactiveList component conditionally?

For example, if I only want to render a ReactiveList component that has an actor's birthday data (day, month, year, city, country, etc) if user enters a query like "when was tom cruise born"

I have a couple ReactiveList components rendering different types of results but am not sure how to do this one??

Yes, ReactiveList in v3 uses Render Prop pattern which comes with callback function and has (data, loading, error, ...) as it params.

So based on the data you can conditionally render any component.

For more information on render prop, you can check docs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM