import { useState } from "react"; import { useMercure } from "react-mercure"; const MERCURE_HUB_URL = "https://localhost/.well-known/mercure"; function App() { const [mount, setMount] = useState(false); return (

React Mercure demo:

{mount && }
); } function MercureComponent() { const { data, isConnected } = useMercure(MERCURE_HUB_URL, [ "https://example.com/my-private-topic" ]); return (

Connection status: {isConnected ? "Connected" : "Connecting..."}

{JSON.stringify(data, null, 2)}
); } export default App;