adom-client
Adom client library
Adom Wrapper
Create an adom wrapper component.
import { AdomClient, AdomProvider, ThemeProvider } from 'adom-client';
const adomClient = new AdomClient(<ADOM_DOCKER_HOST>, <ADOM_DOCKER__PORT>);
const AdomWrapper = ({children}) => {
return(
<ThemeProvider>
<AdomProvider client={adomClient}>
{children}
</AdomProvider>
</ThemeProvider>
)
}
Use adom context
Get context of AdomProvider
import { useAdom } from 'adom-client';
const AssistedContainer = ({children}) => {
const adomContext = useAdom();
return (
<Assisted>
<React.Fragment>
{!!adomContext.initialize &&
<button onClick={init}>
Start call
</button>
}
<button onClick={hangUp}>
Hang up
</button>
{!!adomContext.peerID &&
<div>
PEER_ID => {adomContext.peerID}
</div>
}
</React.Fragment>
</Assisted>
)
}
Guide to create react library
Develop library locally
- On root folder launch these commands:
npm run build
npm link
- Use this linked library in other project:
npm link adom-client
This project was bootstrapped with Create React App.