RC4Community icon indicating copy to clipboard operation
RC4Community copied to clipboard

Create a data-supplier component that wraps a collection of others

Open Sing-Li opened this issue 3 years ago • 3 comments

Investigate into the possibility of creating a component that takes datasource (strapi, URL to JSON, URL to CSV) and populate its children components iteratively with that data. Without:

  1. touching or modifying the styling of its children
  2. having any major assumption about its childrren (except perhaps an exported data population method)

Sing-Li avatar Feb 18 '22 14:02 Sing-Li

Hi @Sing-Li , could you give me an example? I would like to work on this issue.

abhinavkrin avatar Feb 18 '22 14:02 abhinavkrin

@abhinavkrin Please see this ...

https://github.com/RocketChat/RC4Community/blob/master/app/components/infotiles.js#L6

Simplified to:

<DataLoader  id="dl1" src="strapi://infotiles">
   <Infotile    title={dl1.data.1.title}    desc={dl1.data.1.desc}  />
   <Infotile    title={dl1.data.2.title}    desc={dl1.data.2.desc}  />
   <Infotile    title={dl1.data.3.title}    desc={dl1.data.3.desc}  />
  <Infotile    title={dl1.data.4.title}    desc={dl1.data.4.desc}  />
 </DataLoader>

Hope you get the idea.

Sing-Li avatar Feb 18 '22 23:02 Sing-Li