@phoenix-islands/data
v0.2.0-alpha.2
Published
A library for creating islands of various frontend frameworks in Phoenix LiveView.
Downloads
296
Readme
@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
A project by Usage © 2023.