Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React with Monorepo support #635

Closed
ahmeetarif opened this issue Oct 2, 2024 · 1 comment
Closed

React with Monorepo support #635

ahmeetarif opened this issue Oct 2, 2024 · 1 comment

Comments

@ahmeetarif
Copy link

Hello there,

I have a couple of questions about installing this in a React project.

I couldn’t find any installation instructions specifically for React in the documentation. Could you please provide some guidance or a recipe on how to set it up in a React environment?

Is it possible to use this as an editor in one project while having the UI rendering in another, both located in the same folder and using shared components?

Thanks for your assistance!

@chrisvxd
Copy link
Member

Heya @ahmeetarif. There's nothing particularly special about how you might set that up.

If using turbo repo, you could have a setup like this:

apps
-- editor
-- render
packages
-- components
-- puck-config

The main thing you'll want to consider doing is splitting the config for editor and render so you don't include the editor fields to the render app.

i.e. render config

const config = {
  components: {
    HeadingBlock: {
      render: ({ title }) => <h1>{title}</h1>
    }
  }
}

and edit config

import renderConfig from "./render-config.ts";

const config = {
  components: {
    HeadingBlock: {
      ...renderConfig.components.HeadingBlock,
      fields: {
        title: { type: "text" }
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants