Skip to content
Discussion options

You must be logged in to vote

Typically with components that don't really support SSR, you would wrap that in a <ClientOnly> component from remix-utils

First create a lexical.client.tsx file and re-export all the lexical functions

// components/lexical.client.tsx
export * from 'lexical'
export * from '@lexical/react'

Then in your route, import ClientOnly and your lexical components

// routes/editor.tsx
import { ClientOnly } from 'remix-utils'
import { LexicalComposer } from '~/components/lexical.client'

export default Component() {
  return (
    <ClientOnly fallback={<p>Loading</p>}>
      {() => (
        <LexicalComposer>
          //...
        </LexicalComposer>
      )}
    </ClientOnly>
  )
}

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by rodolphoasb
Comment options

You must be logged in to vote
8 replies
@luisrudge
Comment options

@rodolphoasb
Comment options

@luisrudge
Comment options

@luisrudge
Comment options

@luisrudge
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants