Skip to content

Commit

Permalink
Fix compilation error on React < 18
Browse files Browse the repository at this point in the history
The error is "Attempted import error: 'useInsertionEffect' is not exported from 'react' (imported as 'React')."
  • Loading branch information
alex-pex committed Mar 25, 2024
1 parent 8cee71d commit 72e8da5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/wouter/src/react-deps.js
@@ -1,13 +1,14 @@
import * as React from "react";

// React.useInsertionEffect is not available in React <18
const {
useEffect,
useLayoutEffect,
useRef,
useInsertionEffect: useBuiltinInsertionEffect,
} = React;

// React.useInsertionEffect is not available in React <18
const useBuiltinInsertionEffect = React['useInsertion' + 'Effect'];

export {
useRef,
useState,
Expand Down

0 comments on commit 72e8da5

Please sign in to comment.