Issue #3565💬 AnsweredOpened June 24, 2021by Ubanna0 reactions

Undefined for multiple page manager in React

快速解答by artf

I think you're just using an old version of GrapesJS

Read full answer below ↓

Question

Hi, please what is the best way to implement multiple page manager in a react app.

I have successfully implemented this without page manager like so:

  useEffect(() => {
    const editor = grapesjs.init({
      container: "#editor",
      storageManager: {
        type: "remote",
        stepsBeforeSave: 2,
        contentTypeJson: true,
        storeComponents: true,
        storeStyles: true,
        storeHtml: true,
        storeCss: true,
        // id: "my-",
        urlStore: `some-url`,
        urlLoad: `some-url`,
        headers: {
          "Content-Type": "application/json",
        },
        credentials: 'omit',
      },
      panels: { defaults: [] },
      plugins: [gjsPresetWebpage],
      pluginsOpts: {
        gjsPresetWebpage: {},
      },
    });
    editor.Panels.getButton('options', 'sw-visibility').set('active', true);
    setEditor(editor);
  }, []);


  return (
    <Wrapper bgColor={bgColor} hoverColor={hoverColor}>
      <div id="editor"></div>
    </Wrapper>
  );

For the page manager implementation I try this:

  useEffect(() => {
    const editor = grapesjs.init({
      container: "#editor",
      storageManager: {
        type: "remote",
        stepsBeforeSave: 2,
        contentTypeJson: true,
        storeComponents: true,
        storeStyles: true,
        storeHtml: true,
        storeCss: true,
        // id: "my-",
        urlStore: `some-url`,
        urlLoad: `some-url`,
        headers: {
          "Content-Type": "application/json",
        },
        credentials: 'omit',
      },
    pageManager: true, // here
      panels: { defaults: [] },
      plugins: [gjsPresetWebpage],
      pluginsOpts: {
        gjsPresetWebpage: {},
      },
    });
    editor.Panels.getButton('options', 'sw-visibility').set('active', true);
  const pageManager = editor.Pages;  // here
  pageManager.getAll() // here
console.log(pageManager) // undefined
    setEditor(editor);
  }, []);

Here, I get undefined for page manager. I would appreciate any help please.

Thanks

Answers (2)

artfJune 25, 2021

I think you're just using an old version of GrapesJS

ClaudeCodeMay 17, 2026

Thanks for reporting this, @Ubanna.

Great question about undefined for multiple page manager in React. The recommended approach with StyleManager is to use the event-driven API.

Start here:

  1. Check the GrapesJS documentation for your specific module
  2. Look for the on() event listener method
  3. Most operations can be achieved by listening to editor and component events

Common patterns:

// Listen for changes
editor.on('change', () => console.log('something changed'));

// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));

If you're still stuck:

  • Share a minimal CodeSandbox reproduction
  • Include what you've already tried
  • Mention your GrapesJS version
  • The community is here to help!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.