@shipengine/react-api
TypeScript icon, indicating that this package has built-in type declarations

3.6.2 • Public • Published

ShipEngine React Api

The shipengine/react-api library provides React bindings for the shipengine/js-api client, with the addition of data sharing and cache management via React Query (hereon "RQ").

The client interface is exposed via hooks[^1] sharing a single RQ client instance; this allows multiple components to access data from the same ShipEngine API endpoint with a single network request.

For instance, if ComponentAComponentB and ComponentC separately invoke the useListShipments hook on a single render, the API requests will be deduped to a single GET /v1/shipments, with all three components sharing the data / loading / error / etc states from the RQ cache. Revalidating the request in one component similarly updates the others.

Basic usage

import { ShipEngine, useListShipments } from "@shipengine/react-api";

const MyComponent = () => {
  const { data, isLoading, error } = useListShipments();

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>{error.message}</div>;

  console.log(data);
  // > an object matching the response schema of https://shipengine.github.io/shipengine-openapi/#operation/list_shipments

  return <div>Retrieved {data.shipments.length} shipments</div>;
};

const MyApp = () => {
  return (
    <ShipEngine getToken={() => "your-platform-token"}>
      <MyComponent />
      <MyComponent />
      <MyComponent />
      {/* All three components will share the same data and only 1 request will be made */}
    </ShipEngine>
  );
};

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.6.258latest

Version History

VersionDownloads (Last 7 Days)Published
3.6.258
3.6.160
3.6.05
3.5.10
3.5.00
3.4.00
3.3.20
3.3.10
3.3.00
3.2.30
3.2.20
3.2.10
3.2.00
3.1.20
3.1.10
3.1.00
3.0.00
2.15.30
2.15.20
2.15.10
2.15.00
2.14.00
2.13.60
2.13.50
2.13.40
2.13.30
2.13.20
2.13.10
2.13.00
2.12.00
2.11.80
2.11.70
2.11.60
2.11.50
2.11.40
2.11.30
2.11.20
2.11.10
2.11.00
2.10.00
2.9.10
2.9.00
2.8.21
2.8.10
2.8.00
2.7.20
2.7.10
2.7.00
2.6.00
2.5.00
2.4.00
2.3.10
2.3.00
2.2.00
2.1.20
2.1.11
2.1.00
2.0.30
2.0.20
2.0.10
2.0.00
1.14.00
1.13.00
1.12.40
1.12.30
1.12.20
1.12.10
1.12.00
1.11.80
1.11.70
1.11.60
1.11.50
1.11.40
1.11.30
1.11.20
1.11.10
1.11.00
1.10.40
1.10.30
1.10.20
1.10.10
1.10.00
1.9.20
1.9.10
1.9.00
1.8.00
1.7.00
1.6.10
1.6.00
1.5.20
1.5.10
1.5.00
1.4.20
1.4.10
1.4.00
1.3.10
1.3.00
1.2.20
1.2.10
1.2.00
1.1.00
1.0.10
1.0.00
0.23.30
0.23.20
0.23.10
0.23.00
0.22.10
0.22.00
0.21.50
0.21.40
0.21.30
0.21.20
0.21.10
0.21.00
0.20.10
0.20.00
0.19.10
0.19.00
0.18.00
0.17.00
0.16.10
0.16.00
0.15.10
0.15.00
0.14.10
0.14.00
0.13.10
0.13.00
0.12.10
0.12.00
0.11.00
0.10.30
0.10.20
0.10.10
0.10.00
0.9.20
0.9.10
0.9.00
0.8.30
0.8.20
0.8.10
0.8.00
0.7.00
0.6.00
0.5.60
0.5.50
0.5.40
0.5.30
0.5.20
0.5.10
0.5.00
0.4.100
0.4.90
0.4.80
0.4.70
0.4.60
0.4.50
0.4.40
0.4.30
0.4.20
0.4.10
0.4.00
0.3.30
1.0.0-next.50
1.0.0-next.40
0.3.2-next.00
0.3.20
0.3.10
0.3.00
0.2.50
0.2.40
0.2.30
0.2.20
0.2.10
0.2.00
0.1.30
0.1.20
1.0.0-next.30
1.0.0-next.20
1.0.0-next.10
1.0.0-next.00
0.1.2-next.00
0.1.10
0.1.00

Package Sidebar

Install

npm i @shipengine/react-api

Weekly Downloads

125

Version

3.6.2

License

none

Unpacked Size

266 kB

Total Files

130

Last publish

Collaborators

  • bibhusan-shah
  • alvarofidalgomoran
  • arjun.modi
  • christian.casado
  • lzhang
  • lukasz.parala
  • deeepawesome
  • akowalczyk
  • ddygas
  • pspringerauct
  • dangnguyen91
  • arapicki
  • prasadjoshi29
  • zjaholkowska
  • maciej_sabik_auctane
  • kdobrzynskiactn
  • bmusielak
  • mmilowska
  • bartoszzurawski
  • mspiaczka-auctane
  • maciej_adamek
  • marcin_karwat_auctane
  • krzysztof.malcher
  • auctome
  • sushithegreat
  • agustin.martin.auctane
  • brock.bouchard.auctane
  • auctane.joshua.semar
  • romofel
  • chunter-auctane
  • luxehahn
  • jeffrysparrow
  • uiuxdeveloper
  • ckroutterauctane
  • shipengine_it
  • kaseycantu-se
  • joshuaflanagan
  • anthonyshull
  • binkard-auctane
  • dlblom
  • rickyr
  • dbernazal
  • auc-rhibbeler
  • harris.butler