SolidJS

S

SolidJS

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

Join

Solidstart Astro or Vite

Created a SolidStart project and saw that it was using Astro. Looking at the docs it says the project should be in vite. Can anyone tell me what's going on? Mostly interested cause libraries are asking to add something to vite config and I don't know whether to skip that step or I've set up something wrong...

sibling components

I've read the docs, and I just can't wrap my head around how to trigger a function in a sibling component. Can anyone point to a reference that would explain it to a 5th grader? Thanks Sibling-A has a list from a db Sibling-B is able to remove a list item from db...

testing createRouteAction$ using vitest

Hi all! How do I go about testing createServerAction$ in vitest? I'm basically writing ``` export function SomeComponent(props) { const [action, { Form }] = createServerAction$(async (formData: FormData) => { console.log('validationStuff');...

createResource returns undefined

Hello, goodnight everyone. Im having a problem using createResource. This function returns me undefined whenever I try to log it (console.log(data())). I tested to see that this wasn't an issue in my API by logging the response in the fetcher function and everything was as expected. The strangest thing is that I can normally render the result of this resource even though it is undefined.
const [data] = createResource(getGames);
<For each={data()}>{game => (<Game {...game}/>)}</For>
const [data] = createResource(getGames);
<For each={data()}>{game => (<Game {...game}/>)}</For>
...

Suspense doesn't seem to work with ContextProvider

hey, so recently I noticed, If I use createResource(fetch) and then put <Suspense fallback={<Placeholder>}> I will see the placeholder during loading. But if I have createResource(fetch) inside a ContextProvider, i.e.: ```jsx...

Layout for layout group

To make a layout for a route you need to make a .tsx file with the same name as the parent folder. But in case of layout groups, you specify them with (), but you can also rename index.txs of a route with (). How should I name the layout file? (app).tsx, app.tsx, routes.tsx do not work...

SVG A elements not created correctly

When using an <a> element with <Show> or <For> inside an inline SVG element, we get the namespace wrong. Example: ```tsx <svg height="100" width="100" style={{ background: "#000" }}> <Show when={true}>...

How to add events for scrolling like React? (with solid-qurey)

Hi, I've only been dealing with React projects and I'm practicing Solid-js. createResource offers powerful features, but I'm using a solid-query library that I'm more familiar with to handle async. I'm trying to implement infinite scrolls, but I've tried createRenderEffect and on but I'm not sure what event happens when scrolls reach a certain location as I think....

What's the best way to create multiple layouts that only some routes use?

I need to have multiple layouts. I'd like some pages to use different layouts, rather than a single universal layout.

How to stop VS Code from erroring with `Cannot find name 'React'.ts(2304)`?

VS Code is complaining with Cannot find name 'React'.ts(2304) but I am not using React at all. I have both of these in my ts config:
"jsx": "preserve",
"jsxImportSource": "solid-js",
"jsx": "preserve",
"jsxImportSource": "solid-js",
...

How should I use createRouteData

`` export function routeData({ params, location }: RouteDataArgs) { return createServerData$( async ([slug, page]) => { const response = await fetch(/api/list`, {...

How can I access a store from the parent context from inside of a nested context?

I am trying to access the WebsocketContext from inside of the DataStreamContext, in order to send out a websocket message when a DataStreamContext function is called. I can't seem to figure out the right way to do this. Provider structure: ``` <Html lang="en">...

Using `createResource` without triggering suspense

I'm trying to use createResource without triggering Suspense. I realised that data.latest still triggers suspense on first fetch, but providing an initialValue to the resource seems to prevent this. Is this reliable behaviour to rely on? https://playground.solidjs.com/anonymous/25b3cb5c-54b4-4be5-85c1-531ddf2e369c...

`<A>` from `solid-start` is slow on Android. How to debug performance?

So, on my detail page I have a button ```jsx import { A } from 'solid-start'; const Detail = () => {...

Warning on a reactive variable using TSX

I don't know why I get this warning since everything works just a fine as I wanted, unless their might be unexpected behaviors which for now I haven't encountered yet. Please let me know what's going on and maybe some tips on improving what I've done so far!...

How to add derived values in store after creation

Hey folks 👋 I'm trying to add a derived value after the creation of a store. Like the getter example with createMemo (https://www.solidjs.com/docs/latest#getters), but once the store is created. I know it's possible with createEffect to call setStore to update a part of the store in reaction to another part of the store, but it's not ideal:
it's best to avoid setting signals in effects, which without care can cause additional rendering or even infinite effect loops...

Issue with multiple useTransition

https://playground.solidjs.com/anonymous/ad274a3f-5cd0-4fa2-a852-c64bde3cdb77 Use the above playground link to see it in action. When clicking either one of the buttons, both show loading... Is this an expected behavior? A workaround is to use the below useTransition instead...

Trouble porting a React hook to Solid

I'm trying to port the usePlaidLink hook to Solid. But after making some adjustments from the React version, I'm getting a stack overflow error in a basic rendering test. This is what I have: ```typescript export const createPlaidLink = (options: PlaidLinkOptions) => { const [loading, error] = useScript(PLAID_LINK_STABLE_URL);...