8ba2aec022
* fix flight loader for shared components * add tests * fix condition
21 lines
409 B
JavaScript
21 lines
409 B
JavaScript
import { useState } from 'react'
|
|
import Client from './client.client'
|
|
|
|
const random = ~~(Math.random() * 10000)
|
|
|
|
export default function Shared() {
|
|
let isServerComponent
|
|
try {
|
|
useState()
|
|
isServerComponent = false
|
|
} catch (e) {
|
|
isServerComponent = true
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Client />,{' '}
|
|
{(isServerComponent ? 'shared:server' : 'shared:client') + ':' + random}
|
|
</>
|
|
)
|
|
}
|