Frontend
The frontend has
Pages These are routes on your server. For example /about or /dashboard. When you create a new page, you can choose whether Authentication is Required. If you require authentication, users will be redirected to another page if they are not signed in.
Components These are individual react components that you can use in other components or on pages. It's a good idea to keep code you'll use in multiple places in Components. You can create components in folders by adding a path when creating them (e.g. "/my/path/to/NewComponent").
API Learn more here about how to use this to connect to your backend.
Swizzle creates two directories in your frontend server: /pages and /components.
When importing a component from a page, you can access it starting with ../components/
. For example, if you have a component named ComponentName at /path/to/, you could import it into a page with import ComponentName from "../components/path/to/ComponentName"
.
If you're importing a component from another component, just follow the directory structure you can see in the sidebar.
Don't import from the root directory (e.g. /my/path). Instead use relative directories (e.g. ./my/path). Using the root directory won't work since your pages and components folders are located under /swizzle/code/frontend/src/...
Last updated