React Redux Fetch

React Redux Fetch

  • Getting started
  • API
  • Examples
  • GitHub

›API

Getting Started

  • Getting Started
  • Basic Example
  • How does it work?

Typing

  • Flow type
  • Typescript

API

  • <ReduxFetch />
  • reduxFetch()
  • fetchConfig
  • container
  • buildActionsFromMappings

Examples

  • Examples

ReduxFetch

The ReduxFetch component is one of the two ways to connect react-redux-fetch to your component. You can read more about the other way (reduxFetch HoC) here.

The technique used for ReduxFetch is a commonly used technique for code sharing in React, called "Render Props".

Importing

var ReduxFetch = require('react-redux-fetch').ReduxFetch; // ES5

import { ReduxFetch } from 'react-redux-fetch'; // ES6

Props you can pass to ReduxFetch

  • config: Array [required]

    Read more in the FetchConfig documentation for all possible config properties.

  • fetchOnMount: Boolean|Array [optional]

    Automatically call an API endpoint when the component is rendered. When a boolean is given, all endpoints from the config prop are called. When an array is given, only the resource names which are given to the fetchOnMount prop are called.

  • onFulfil: (ResourceName, PromiseState<*>, DispatchFunctions) => void [optional]

    Called every time one of the configured resources transitions from the pending to the fulfilled state.

  • onReject: (ResourceName, PromiseState<*>, DispatchFunctions) => void [optional]

    Called every time one of the configured resources transitions from the pending to the rejected state.

  • children: Object => React.Node [required]

    A function which receives an object of promise states and dispatch functions. You can read more about the generated promise states and dispatch functions here. The function should return a React node, which will be rendered.

Usage

← PreviousNext →
  • Importing
  • Props you can pass to ReduxFetch
  • Usage
React Redux Fetch
Docs
Getting StartedAPI ReferenceExamples
More
npmGitHubStar