Skip to content

I can't show data via data attributeΒ #378

@EdKo2001

Description

@EdKo2001
import { Editor, Frame, Element } from "@craftjs/core";
import { Container } from "../components/selectors";
import { NextPageContext } from "next";

const Page = (props) => {
  return (
    <div>
      <h2>My App!</h2>
      <Editor
        resolver={{
          Container,
        }}
      >
        <h2>My Page Editor</h2>
        <Frame data={props?.formattedData}>
          {/* <Frame> */}
          <Element is={Container} canvas>
            // defines the Root Node
            <h2>Drag me around</h2>
            <Element is="div" style={{ background: "#333" }}>
              <p>Same here</p>
            </Element>
          </Element>
        </Frame>
      </Editor>
    </div>
  );
};

// This gets called on every request
export async function getServerSideProps() {
  // Fetch data from external API
  const data = await import("../data/example.json");
  const formattedData = JSON.stringify(data);

  // Pass data to the page via props
  return { props: { formattedData } };
}

export default Page;

The error:
image

P.S. I've tried as JSON file from crast.js example and from saving my examples.

Your environment

Software Version(s)
craft.js 0.2.0-beta.2
React 17.0.2
TypeScript 3.7.5
Browser
npm/Yarn 8.3.0
Operating System Win 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions