SolidJS

S

SolidJS

Solid is a declarative reactive Javascript library for creating user interfaces.

Join

Eslint, am I doing something wrong?

```js const ToggleButton: Component<Props> = (props) => { const [local, others] = splitProps(props, ["toggled"]); const [toggle, setToggle] = createSignal(local.toggled); ...

CreateEffect has infinite loop

So I am having an infinite loop issue with an effect that I am trying to figure out how to handle without having to resort to createReaction() since I find those are less than ideal to work with but maybe that is the only SingleInFormAutoShowOptions. I have this code: ```ts...

createResource returning undefined when data is fetched

I'm just learning solid and did something like a hook? maybe? dunno. Anyways, I'm just calling createResource with a fetch on it and returning it's json. But, for any reason, that fn is returning undefined, even when the data is properly fetched("tested" by logging the json)....

Question about onError

```jsx onError((err) => { console.error(err); }) ...

[solved] Brain fart: in need of fresh eyes

I just can't seem to access the results outside of the function in my returned jsx. Hoping to loop and create <option value={item.id}>{item.name}</option> Thank you in advance....

[Solved] Reactivity problem when refreshing the page

I've got a route, where I'm fetching data with server$ function, which sits inside createResource and it works fine, when I'm navigating. But when I'm refreshing, I can see that it fetches on the server, but Resource doesn't get updated on client side. What am I doing wrong? ```typescript const [data] = fetchFolders(); createEffect(() => console.log(data()));...

Is Static Site Generation possible with SolidJS?

I want to know if it's possible to implement ssg with SolidJS without SolidStart? Any libraries etc.? Thanks...

Does <Show> narrow types in typescript?

I am getting undefined errors even though I wrap it in a show block.

Get SSR attribute value when hydrating

Hi guys! The server generates an attribute value for an element and I don't want to re-generate that attribute value on the browser side because it's unnecessary load on the user device. Is it possible to access the to-be-updated element from within the client side component function code? e.g. ```js const myAttr = createSignal(isServer ? doHeavyCalculationThing() : hydrationEl.dataset.myAttr);...

Cannot find name 'React' when using Astro + TypeScript

I configured my Astro project to use SolidJS and even though I added the required tsconfig.json VSCode highlights every JSX tag with an error: Cannot find name 'React'.ts(2304) Astro compiles and runs fine, and tsc --noEmit also shows no errors. ...

Loading data into context

Hi what's the best practice to load data from server (like using prisma) into the context? i did try some method like using createServerData$ but seems like only if I call the getter function inside the JSX Element, then the fetcher will work, other wise it won't, the data.state is just pending, won't beready...

Listening to all changes in an array or object in a store

Hi! I have a store that has arrays and objects inside it. I want to listen to all changes in a tree. For instance, suppose this is my store: ```json {...

Problem creating web component with solid-element

Hi, I'm trying to create an image carousel web component by wrapping an existing JS library (called Glide) within a Solid component. As a regular solid component it works fine, but when I try to convert it to a web component I get an error from the Glide saying indicating that it cannot find the root element on which to mount the image carousel. It seems the initialization which I place within the onMount hook cannot access the elements of the shadow DOM (???) The code is below. Any insights would be appreciated. ``` import {Component, createEffect, createSignal, JSX, onMount} from "solid-js" import Glide from "@glidejs/glide"...

Confusion around solid-query

coming from Angular, so I'm new to both solidJS and solid-query/react-query, when writing a useAuth hook, how would you go about fetching and storing the initial session? ```typescript...

[solved] DB change not being reactive?

Isn't createResource reactive? I have one and when I changed the value in the db the fetcher didn't respond. Or is reactivity just within the code base interactivity? Or should I be using createMemo So, I tried createMemo together with createEffect but that doesn't seem to be working either. My initial try was with createResource Thoughts?...

How to add child to parent component outside of parent?

I know this doesn't work. But is there way to add child like this instead doing <div > <Child /> < /div>...
No description

Transform property on all elements

I want to write my JSX with Linaria like this: ```jsx <div class="w-full font-mono" ...

Context store issue with array

Hello, I apologize but I just allowed myself to make a second post, since now I have a codesandbox to reproduce the issue I have in my app. Situation: I have a store in a context, and the context object also contains setters to update the store (I tried to do the same as the CounterContext in the documentation: https://www.solidjs.com/docs/latest#createcontext). The problem is, in my app I have several components, each of them containing the value at their own index in an array of my store. And each component receives, from the context, a setter function that updates the value in the array at their index....

[solved] createEffect signal is Undefined

I can't seem to figure out why the signal user is not updating (the output near Profile). The signal does get populated. Clues? Tutorial link with real-world example? Thanks....