Best way to Read JSON files (Locally Stored)

Hello all, Just picked up Solid for the first time today after learning a little react. 1) Where is the best place to get the most up to date documentation? The SolidJS website is a little light on specific syntax and such compared to other languages and frameworks. 2) I have a locally stored JSON file which I want to read from (Displaying names, descriptions and pictures of items for e-commerce store.) What is the best way to get that info? Any help would be highly appreciated ESPECIALLY pointing me in the direction of the more detailed documentation. All the best
11 Replies
pilcrow
pilcrow2y ago
For #2, if you’re using typescript or Vite, you can import the JSON file directly with import someName from “somePath/someFile.json”
twisteddisco
twisteddiscoOP2y ago
Thanks for responding. I do have a vite.config.js file as part of my project so I am assuming vite is active but your suggestion is the first thing I tried and I could not get it working.
thetarnav
thetarnav2y ago
there is an option for resolving json in tsconfig
twisteddisco
twisteddiscoOP2y ago
I am not using type script unfortunately 😦
twisteddisco
twisteddiscoOP2y ago
https://www.youtube.com/watch?v=ZZ-a7B761Ds&t=123s @59.50 they managed to do an API call of some JSON. I tried to copy it but a bunch of errors come up
Learn With Jason
YouTube
Let's Learn SolidJS
SolidJS is an exciting framework with a small (6.4kb) footprint, a reactive, component-based approach, and incredible performance. In this episode, Ryan Carniato will teach us how to get started with our first SolidJS app! 00:00:00 Welcome 00:00:24 Guest introduction 00:02:46 Jason's initial thoughts on SolidJS 00:04:21 What's different about S...
twisteddisco
twisteddiscoOP2y ago
No description
twisteddisco
twisteddiscoOP2y ago
No description
twisteddisco
twisteddiscoOP2y ago
This one is from the vid
No description
x_arthurx
x_arthurx17mo ago
same question here. It seems this question has never been answered. @twisteddisco Do you have a proper solution now?
thetarnav
thetarnav17mo ago
vite supports it naively though: https://vitejs.dev/guide/features.html#json
Vite
Next Generation Frontend Tooling
twisteddisco
twisteddiscoOP17mo ago
Hey, yeah i eventually went with a vanilla JS approach but will have another look at some point 🙂
Want results from more Discord servers?
Add your server