Skip to content

React component to declaratively fetch from OData v3 endpoints

License

Notifications You must be signed in to change notification settings

cruxinator/POData-React

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-odata

React component to declaratively fetch from OData v4 endpoints

Install

yarn add react-odata

or

npm install --save react-odata

Usage

Import

import OData from 'react-odata';

Basic

const baseUrl = 'http://services.odata.org/V4/TripPinService/People';
const query = { filter: { FirstName: 'Russell' } };

<OData baseUrl={baseUrl} query={query}>
  { ({ loading, error, data }) => (
    <div>
      { loading && {/* handle loading here */} }
      { error && {/* handle error here */} }
      { data && {/* handle data here */}}
    </div>
  )}
</OData>

Passes remaining props to underlying <Fetch /> component

<OData baseUrl="http://services.odata.org/V4/TripPinService/People" options={{ credentials: 'include' }} />

About

React component to declaratively fetch from OData v3 endpoints

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%