https://github.com/techniq/react-odata
React component to declaratively fetch from OData v4 endpoints
https://github.com/techniq/react-odata
odata react
Last synced: 10 months ago
JSON representation
React component to declaratively fetch from OData v4 endpoints
- Host: GitHub
- URL: https://github.com/techniq/react-odata
- Owner: techniq
- License: mit
- Created: 2017-02-05T20:06:41.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-13T09:35:38.000Z (over 5 years ago)
- Last Synced: 2025-03-13T00:56:07.828Z (10 months ago)
- Topics: odata, react
- Language: JavaScript
- Homepage:
- Size: 253 KB
- Stars: 32
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-odata
React component to declaratively fetch from OData v4 endpoints
## Install
```
yarn add react-odata
```
or
```
npm install --save react-odata
```
## Usage
### Import
```js
import OData from 'react-odata';
```
### Basic
```js
const baseUrl = 'http://services.odata.org/V4/TripPinService/People';
const query = { filter: { FirstName: 'Russell' } };
{ ({ loading, error, data }) => (
{ loading && {/* handle loading here */} }
{ error && {/* handle error here */} }
{ data && {/* handle data here */}}
)}
```
- See [odata-query](https://github.com/techniq/odata-query) for supported `query` syntax
### Passes remaining props to underlying `` component
```js
```
- See [react-fetch-component](https://github.com/techniq/react-fetch-component) for additional props