Loop

From SocialStack
Revision as of 15:26, 9 November 2021 by Luke (talk | contribs) (→‎Sample Usage)

<Loop> is a very commonly used React component installed by default in SocialStack projects. It is used to loop over lists of items typically from the API.

Sample Usage

Simple loop over everything of a given type (user in this case). Note that it will always be restricted by what you are permitted to see.

     <Loop over='user/list'>
       {
           user=> {
                  return <p>{user.username}</p>;
           }
       }
     </Loop>


     <Loop over='page/list' filter={
       {
              where: {
                     url: {
                            startsWith: '/en-admin/'
                     }
              }
       }
     }>
       {
           page => {
                  return <p>{page.title}</p>;
           }
       }
     </Loop>