Excalidraw share peer link is a lib for React 16+, he provide a simple <a>
link and function for generate the href to open new tab of Excalidraw with peer session.
npm install --save excalidraw-share-peer-link
yarn add excalidraw-share-peer-link
Just add the Widget component and generate the link with the generateLink function
import React, { useState, useEffect } from 'react';
import ExcalidrawLink, { generateLink } from 'excalidraw-share-peer-link';
function App() {
const [link, setLink] = useState('');
useEffect(() => {
generateLink().then(result => {
setLink(result);
})
}, [])
return (
<div className="App">
<ExcalidrawLink link={link} label="Go to whiteboard" />
</div>
);
}
export default App;
You can bypass the complete link generation and import generateRandomID and generateEncryptionKey and insert those in arguments of generateLink for custom id and key.