1 | import * as React from 'react'
|
2 |
|
3 | const isBrowser = typeof document !== 'undefined'
|
4 |
|
5 | const useInsertionEffect = React['useInsertion' + 'Effect']
|
6 | ? React['useInsertion' + 'Effect']
|
7 | : function useInsertionEffect(create) {
|
8 | create()
|
9 | }
|
10 |
|
11 | export default function useInsertionEffectMaybe(create) {
|
12 | if (!isBrowser) {
|
13 | return create()
|
14 | }
|
15 | useInsertionEffect(create)
|
16 | }
|