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

0.2.0 • Public • Published

centrifuge-react - Centrifuge React library

This package contains React components and utilities, combining centrifuge-js and fabric

Getting started

To start using this package, install the package and its peer dependencies:

# yarn
yarn add @centrifuge/centrifuge-react @centrifuge/centrifuge-js @centrifuge/fabric react react-dom styled-components

# npm
npm install --save @centrifuge/centrifuge-react @centrifuge/centrifuge-js @centrifuge/fabric react react-dom styled-components

Import the Provider component, Fabric's FabricProvider component and a theme, and add them to the root of your React app.

import { Provider } from '@centrifuge/centrifuge-react'
import { FabricProvider, GlobalStyle, centrifugeLight } from '@centrifuge/fabric'
import centrifugeLight from '@centrifuge/fabric/dist/theme/centrifugeLight'

// Optionally override the config for CentrifugeJS
// Needs to me memoized, so as not to recreate an instance of CentrifugeJS each render
const config = {
  network: 'altair',
}

function App() {
  return (
    <Provider centrifugeConfig={config}>
      <FabricProvider theme={centrifugeLight}>
        <GlobalStyle />
        {/* Rest of your React app */}
      </FabricProvider>
    </Provider>
  )
}

Development

With Storybook

$ yarn storybook

Will start the Storybook to allow development of the components in isolation

Watch mode

$ yarn start

Will build locally and listen for changes, allowing to see the changes directly when working on centrifuge-app, for example

Publishing a new version

Create a new branch and run yarn bump, which bumps the package version, updates the changelog, creates a commit and tags it. Push the branch/tag, which should publish the version to NPM. Open a PR to merge the changes to main. For generating the changelog, make sure to use the conventional commits spec in your commits, with centrifuge-react as the scope, e.g.: feat(centrifuge-react): Add useCentrifugeQuery

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.02latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.02
0.1.11
0.1.01
0.0.41
0.0.31
0.0.21
0.0.11

Package Sidebar

Install

npm i @centrifuge/centrifuge-react

Weekly Downloads

8

Version

0.2.0

License

ISC

Unpacked Size

324 kB

Total Files

198

Last publish

Collaborators

  • onno
  • lucasvo
  • offerijns