@phoenix-islands/data
TypeScript icon, indicating that this package has built-in type declarations

0.2.0-alpha.2 • Public • Published

@phoenix-islands/data

Phoenix Islands is a library for creating islands of various frontend frameworks in Phoenix LiveView.

Install

cd assets
npm i react @phoenix-islands/data

Or

yarn add @phoenix-islands/data

Usage

Install elixir library

Follow instruction here to install server part

Register the component with live-view hooks

import { registerReactIsland } from '@phoenix-islands/react'

let liveSocket = new LiveSocket('/live', Socket, {
  params: { _csrf_token: csrfToken },
  hooks: {
    ...registerDataIslands({
      Logger: {
        subscribe(store, globalStore) {
          const u1 = store.subscribe(console.log)
          const u2 = globalStore.subscribe(console.log)
          return () => {
            u1()
            u2()
          }
        }
      }
    })
  }
})

License

GitHub

A project by Usage © 2023.

Package Sidebar

Install

npm i @phoenix-islands/data

Weekly Downloads

11

Version

0.2.0-alpha.2

License

MIT

Unpacked Size

5.7 kB

Total Files

9

Last publish

Collaborators

  • cinoss