React with GrapeJS
@sakshigarg9 add grapesjs via npm, then in your code just use import grapesjs from 'grapesjs' It will work, without any need to update the webpack configuration
Read full answer below ↓Question
Greetings, I did searches and could not particularly find a solution to my problem. Currently, I am trying to integrate my React App with GrapeJS. import React, { Component } from 'react'; import './GrapesSrc/grapes.min.js'; import GrapesIndex from 'grapejs'; class GrapesEditor extends Component { constructor(props){ super(props); } shouldComponentUpdate(){ return false } componentDidMount(){ const editor = grapesjs.init({ container : '#gjs', components: '<div class="txt-red">Hello world!</div>', style: '.txt-red{color: red}', }); } render() { return ( <div id ='gjs'> </div> ); } } export def...
Answers (3)
@sakshigarg9 add grapesjs via npm, then in your code just use import grapesjs from 'grapesjs' It will work, without any need to update the webpack configuration
@Silavin Have you succeed with integrating grape and react?
If you're using webpack to build your React app, you can include it as a plugin. It'll pull it from node_modules.
plugins: [ new webpack.ProvidePlugin({ grapesjs: "grapesjs" }) ],
This worked for me.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1864
[QUESTION] Best way to listen to changes on the final HTML?
Hi, I just had a quick question because I could not figure out how to do it or did not find an issue related to it. I am just trying to cal...
Issue #1818
[Question]: Making grapesjs working with angular7 and material
I'm trying to integrate the library with Angular7, but got problem when moving container <div id="gjs"></div>into the material component (s...
Issue #1960
[QUESTION] Dynamic class generation with a template
Hi there ! I am wondering if there is a way to force the dynamic class generation (of the form cXXXXX which happens when I drag'n'drop a co...
Issue #1707
Find images links in the editor
I am trying to integrate GrapesJs in reactJs. Can you please help me out with the below question w.r.t GrapesJs-React, • Is there a way to...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.