React with GrapeJS- without plugin
Question
Hi, How can I use grapesjs with react? I don't want to use the plugin- I have made some changes and I want to use the editor with react and other pages. how can I do it?
Thanks you vaety much!
Answers (3)
Not sure what you mean by without plugin.
But if you are talking about just the GrapesJS instance, you just need to initialize it in componentDidMount.
So for example:
In your render
render() {
return <div id="gjs"></div>
}
In componentDidMount
const editor = grapesjs.init({
// Indicate where to init the editor. You can also pass an HTMLElement
container: '#gjs',
});
Something like that, normally it should work.
Nothing to add beyond what already said by @simplecommerce
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1193
[QUESTION] Not able to initialize colorpicker !
Hi @artf , I made separate styles for mobile view . i want to initialize color-picker "onclick()". i want exactly same color-picker that yo...
Issue #1322
Disable editing in Preview Mode.
@artf How can we disable editing in the preview mode and re-enable it when preview mode off. I want to remove editor and hide toolbar in th...
Issue #1748
How to prevent drag items inside the editor
Hello @artf You are doing great job with grapesjs and it's extremely helpful to make our functionality more user friendly. Thanks for creat...
Issue #580
[Question] Any/Trigger event when any block is dropped inside canvas?
Hey, How can I trigger some event when any new block or content inside canvas is updated? Something like editor.onCanvasUpdate() Thanks!
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.