Skip to content

Commit

Permalink
fix: ssr warning due to useLayoutEffect (#3862)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mokshit06 committed Apr 27, 2022
1 parent 8b01313 commit 4321690
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/react-table/src/index.tsx
Expand Up @@ -52,6 +52,9 @@ function isExoticComponent(component: any) {

export const createTable = createTableFactory({ render })

const useIsomorphicLayoutEffect =
typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect

export function useTableInstance<TGenerics extends AnyGenerics>(
table: Table<TGenerics>,
options: PartialKeys<
Expand Down Expand Up @@ -93,7 +96,7 @@ export function useTableInstance<TGenerics extends AnyGenerics>(
},
}))

React.useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
instance.willUpdate()
})

Expand Down

1 comment on commit 4321690

@vercel
Copy link

@vercel vercel bot commented on 4321690 Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

react-table – ./

react-table-git-alpha-tanstack.vercel.app
react-table-v8.tanstack.com
react-table-tanstack.vercel.app

Please sign in to comment.