react-apiflow
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

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;

Readme

Keywords

none

Package Sidebar

Install

npm i react-apiflow

Weekly Downloads

0

Version

0.1.8

License

MIT

Unpacked Size

43.7 kB

Total Files

29

Last publish

Collaborators

  • marstree