Aninsi Sasberg
How do i fetch data correctly in a route?
Hi, I am currently trying to fetch a .json, which I just need to import an array, that I then assign to a signal. But I can't seem to get the path right (do I need API / Proxy?), and before that I had the problem of top level await not being allowed in my build target ES2019.
At first I used async functions outside of my exported component, and now currently I am trying to fetch the data with createResource.
my current createResource approach
my previous attempt with top level await error
5 replies
SolidJS with Vite vs Solid Start
Hi, I am very new to Web Development in general, and am currently struggling with understanding what a "framework" is comprised of. I started developing my Website in Svelte + SvelteKit and then hit a big problem I couldn't figure out. After that I was looking around for a framework with more control over the reactivity. After playing around with Solid for a few days I started porting what I had already written in my Svelte project and even figured out how to solve my problem. Theen I tried building it for the first time and noticed that SolidJS in itself isn't a whole framework, but SolidStart is (I had CORS related problems with SolidJS when i built it). So I started porting my SolidJS stuff to SolidStart, and now I basically have similar problems as with Svelte + SvelteKit.
My main problems are:
- Implementing a Theme Switch (auto | light | dark), without having FOUC
- Loading .json data (haven't done this in SolidStart yet, just in Svelte and in SolidJS (where it worked))
(- My fonts are in the public directory, but when building I always get the error "didn't resolve at build time, it will remain unchanged to be resolved at runtime" when importing the fonts from my app.css with the path being relative from the public directory as stated in the docs.)
So basically I have a problem with when in the lifecycle I should instantiate / update my values. (e.g. for the theme switch I use localStorage, which I (think), I can just call with onMount)
7 replies