0.1.8 • Published 11 months ago

react-apiflow v0.1.8

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

Getting Started with React-Apiflow

This repo is for getting started with React-Apiflow

Installation

please install the following packages:

npm install react-apiflow

Usage

1. Request API

The example code is as follows:

import React from 'react';
import Apiflow, {ApiflowContext} from 'react-apiflow';

const Component = () => {

   // get API response from Apiflow
   const { response } = React.useContext(ApiflowContext);

    return (
      <>
        ...
        {/* call API with Apiflow and pass the API_ID*/}
        <Apiflow apiId="API_ID">
          <ul>
            {response?.data.map((item, index) => (
              <li key={index}>{item.name}</li>
            ))}
          </ul>
        </Apiflow>
        {/* script to call API */}
        ...
      </>
    );
}

export default Component;