@coralblack/flax
TypeScript icon, indicating that this package has built-in type declarations

0.1.18 • Public • Published

flax

flax

flax is consists of components that help you invoke HTTP API super-simply.

Installation

npm install --save @coralblack/flax

Usage

import 'flax/dist/styles/index.css';
import {FxButton, FxGuard} from 'flax';

FxGuard

A component that makes it super simple to HTTP API inquiry requests.

<FxGuard
  api={{
    method: 'GET',
    url: 'https://jsonplaceholder.typicode.com/todos/1',
  }}
  render={data => (
    <>
      <div>
        <label>userId:</label> {data.userId}
        <br />
        <label>id:</label> {data.id}
        <br />
        <label>title:</label> {data.title}
      </div>
    </>
  )}
/>

FxButton

A component that makes it super simple to HTTP API invoke requests.

<FxButton
  label="Post"
  api={{
    method: 'POST',
    url: 'https://jsonplaceholder.typicode.com/posts',
  }}
  success={(res) => document.location.href = '/posts/' + res.id}
  error=((err) => Message.show(`An error has occurred. (${err.message})`))
/>

Author

License

MIT. Copyright © 2020 CORAL.BLACK.

Dependencies (5)

Dev Dependencies (20)

Package Sidebar

Install

npm i @coralblack/flax

Weekly Downloads

1,121

Version

0.1.18

License

MIT

Unpacked Size

310 kB

Total Files

28

Last publish

Collaborators

  • why2pac