Hacker News new | ask | show | jobs
by ReD_CoDE 1177 days ago
How to change components? I tried to change them but I don't know how Nice work, but this way is a bad way, even if there be some similar web builders that are "somewhat" successful
1 comments

I assume you are asking about how to change a component that a template is referencing. A component template's node that is stored in the State looks like so: { type: "ComponentTemplate", component: { type: "Identifier", name: "Button" } }

So to change "Button" to another component would basically mean changing the component.name property to a different component. I didn't add the UI to do this in the demo, but you could try this on the demo by clicking on the "Edit code" button and changing the template tag.

I would like to hear more why you think this is a bad way. Just to clarify, Reka is NOT a page builder by itself. It's a state management system to build a page builder (or any no-code editor), so it's up to the consumer to build easy-to-use UI abstractions on top of Reka. For example, to achieve the example above where the user can change components - we could easily build a button that simply mutates the underlying state.