I have just discovered builder so of course jumped right in but perhaps I have misunderstood how I can use it. Can I use builder.io as a visual editor for my react js app?
I have installed builder into my project and am importing it into index.js like so:
import { builder } from â@builder.io/reactâ;
builder.init(process.env.BUILDER_API_KEY);
require(âdotenvâ).config();
I have created a .env file and have used my public key
then I went to builder.io and fetched my localhost url and itâs there, but just not editable. So must be missing something and perhaps a lot?
thanks in advance
Linda
Thanks for reaching out and welcome to Builder! If you can send me your Builder page url, Iâd be happy to dive in further. It sounds like youâve taken the correct steps to integrate Builder into your react app, but youâll also want to make sure you connect it in Builder as well following this guide.
@kara thanks a mil for answering so soon
This is definately happening because I forgot to add the following but when I try and add it to my index.js I get the following error.
hey there @aziz thanks a mil for helping me out after messing up a few times because I kept forgetting to delete the old code I got the site to run with the follwing code in my index.js
I added a new page to my builder.io dashboard and plottet in:
localhost:3000/builder-editing in the preview url + I activated the proxy. The page I want does render, but I cannot edit it.
what might I be missing?
â
import React from âreactâ;
import ReactDOM from âreact-domâ;
import { createBrowserHistory } from âhistoryâ;
import { Router, Route, Switch } from âreact-router-domâ;
import "assets/scss/material-kit-react.scss?v=1.9.0";
// pages for this product
import Components from "views/Components/Components.js";
import LandingPage from "views/LandingPage/LandingPage.js";
import ProfilePage from "views/ProfilePage/ProfilePage.js";
import LoginPage from "views/LoginPage/LoginPage.js";
import SectionBasics from "./views/Components/Sections/SectionBasics";
import {builder, BuilderComponent} from '@builder.io/react';
builder.init(process.env.BUILDER_API_KEY);
require('dotenv').config();
export default function MyComponent(props) {
return <BuilderComponent content={props.content} model="page"/>
}
var hist = createBrowserHistory();
ReactDOM.render(
<Router history={hist}>
<Switch>
<Route path="/my-test" component={SectionBasics} />
<Route path="/landing-page" component={LandingPage} />
<Route path="/profile-page" component={ProfilePage} />
<Route path="/login-page" component={LoginPage} />
<Route path="/" component={Components} />
</Switch>
</Router>,
document.getElementById("root")
);
Hi @aziz I was on 1.1.41 so changed the versioni to 1.1.40 but still I can only preview the site not edit on http://localhost:3000/builder-editing. Perhaps I can have you guys take a look at what I am doing wrong if I jump on the basic plan?
Hey @creativemac! Would you mind sending us your public API key, and if you could create a CodeSandbox with some minimal code that reproduces/triggers the problem and send the link to us, that could help us a lot. Thank you!
If youâre using Builder Io to visually React develop apps with drag-and-drop, you can tailor visual components for your team by using custom React components.
You can create any component your team requires in Builder, configure options for variability, and your teammates can use and reuse your components throughout the app. Freeing up developer time while allowing non-coding team members to iterate and publish on their own boosts efficiency and encourages creativity throughout the team.