Skip to content

Commit

Permalink
Fix "useLayoutEffect does nothing on the server" warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
VeskeR committed May 24, 2024
1 parent 9547685 commit 2630387
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import '../styles/globals.css';
import * as Ably from 'ably';
import { AblyProvider, ChannelProvider } from 'ably/react';
import { AblyProvider } from 'ably/react';
import dynamic from 'next/dynamic';

// fixes "Warning: useLayoutEffect does nothing on the server" warning spam from next.js
const ChannelProvider = dynamic(() => import('ably/react').then((module) => module.ChannelProvider), { ssr: false });

export default function App({ Component, pageProps }) {
const client = new Ably.Realtime({
Expand Down

0 comments on commit 2630387

Please sign in to comment.