-
-
Notifications
You must be signed in to change notification settings - Fork 819
Closed
Description
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;
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
Labels
No labels
