decaporg / decaporg/decap-cms

feat: export the Root app in decap-cms-app, and add a flag to disable rendering

Open
#7,368 0 comments 0 reactions 0 assignees View on GitHub
type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

It would be awesome if `decap-cms-app` exposed the `Root` component defined in `decap-cms-core`, and introduced a flag to disable rendering the app by default.

**Is your feature request related to a problem? Please describe.**
Somewhat. Decap doesn't always play nicely when it is inside of another React rendering context. Instead of using `react-dom` to directly render decap into a DOM node, it would be great to simply expose the component and let the hosting React app handle the rendering.

**Describe the solution you'd like**
```jsx
import DecapCMS, { Root as CMSApp } from 'decap-cms-core';

function MyReactComponent() {
DecapCMS.init({ config, render: false });
DecapCMS.registerPreviewTemplate(...);
return (




);
}
```

**Describe alternatives you've considered**
With a deeper refactor, it would probably be good to disable the auto-init stuff as well by default, which would give more control to the app.

The final solution could be entirely component based...
```jsx
import { Root as CMSApp } from 'decap-cms-core';

function MyReactComponent() {
return (
<>


);
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.