![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
jam-core-react
Advanced tools
React hooks for creating custom audio spaces like Clubhouse / Twitter Spaces, made with WebRTC
jam-core
is client-side JavaScript/TypeScript library for Jam. You can find out more about Jam on our Gitlab page.
jam-core-react
is a package that helps integrating jam-core
in a React app.
You can use it to build custom Jam UIs.
npm i jam-core-react
import React, {useState, useEffect} from 'react';
import {render} from 'react-dom';
import {JamProvider, useJam, use} from 'jam-core-react';
const jamConfig = {domain: 'jam.systems'};
// Wrap your app in a Provider
render(
<JamProvider options={{jamConfig}}>
<App />
</JamProvider>,
document.querySelector('#root')
);
function App() {
// get Jam state and API methods
let [state, api] = useJam();
// listen to specific state changes
let [myIdentity, roomId] = use(state, ['myIdentity', 'roomId']);
return (
<div>
User: {myIdentity.info.name ?? ''},<br />
Room: {roomId ?? ''}
</div>
);
}
The state
and api
objects are the same as returned by createJam()
in jam-core
. See the jam-core documentation for extensive documentation and examples of how to use them.
The additional steps to integrate with React are simple:
JamProvider
. This will call createJam()
for you.useJam()
hook to get state
and api
in any component inside the Provideruse(state, keys)
hook to update the component whenever one of the keys
in state
change.We have a complete example for a simple UI built with React: https://gitlab.com/jam-systems/jam/-/blob/master/ui/examples/tiny-jam-react/App.jsx
This example lets users create Jam rooms, share rooms by URL and talk to each other when in the same room -- in less than 100 lines of code.
The example is live on https://tiny-jam-react.vercel.app
FAQs
React hooks for creating custom audio spaces like Clubhouse / Twitter Spaces, made with WebRTC
The npm package jam-core-react receives a total of 6 weekly downloads. As such, jam-core-react popularity was classified as not popular.
We found that jam-core-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.