All Projects → BojanGvozderac → restpollo

BojanGvozderac / restpollo

Licence: MIT license
React components for declarative communication with a REST API inspired by Apollo

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Restpollo

React components for declarative communication with a REST API inspired by Apollo

DISCLAIMER: Restpollo isn't an official Apollo project. They did such a good job with React Apollo that it inspired me to create a simplified version for communicating with a REST API using React components and function as children pattern.

Examples Site Link

API

Prop Description
url This is the url for the fetch action
fetchOptions These are the options for the fetch action
fetchOnMount If this prop is set the fetch action will be trigger when the component is mounted

Usage Example

<Fetch url={getUrl} fetchOptions={FETCH_OPTIONS} fetchOnMount>
  {
    ({ loading, error, data }) => {
      if (error) {
        return <Error />
      }

      if (loading) {
        return <Loader />
      }

      if (data) {
        return (
          <div className="items">
            {
              data.map(
                item => (
                  <div className="item" key={item.id}>
                    <h2 className="item__title">{item.title}</h2>
                    <p className="item__body">{item.body}</p>
                  </div>
                )
              )
            }
          </div>
        );
      }

      return <p className="text-align-center">Waiting for fetch event</p>
    }
  }
</Fetch>

Wanna find out how I got the idea for Restpollo?

Medium post coming soon!

Where to find me

Need an experienced tech guy to consult you and help you navigate the world of web development? Drop me a line!
Need a developer or team of developers to build you dream app? Let's talk!
I'm always open for new opportunities and meeting new people so if you're thinking about getting in touch, go for it!

Linkedin
Medium
Dev.to
Twitter

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].