from "@tanstack/solid-query" import { api } from "../common/ApiInstance" import { Match, Switch } from "solid-js" const Post = () => { //这里使用了useParams函数,这个函数用于获取路由参数 const params = useParams() const post = createQuery({ queryKey: () => ["post", params.id...
id, fetchUser); // 获取 user,但仅在加载此资源后才流式传输内容 const [user] = createResource(() => params.id, fetchUser, { deferStream: true, }); v1.5.0 中的新功能我们添加了一个新的 state 字段,它涵盖了 loading 和error 之外的更详细的资源状态。您现在可以检查资源是否为 "unresolved"...
Since this setup is not instantaneous, you need to first use asynchronous queries (findBy) after employing it:it('uses params', async () => { const App = () => ( <> <Route path="/ids/:id" component={() => Id: {useParams()?.id}} /> <Route path="/" component={() => ...
sider调用组件 importuseDeviceSizefrom"./screensize";importSliderfrom"./swiper";import{For,Show}from"solid-js";import{items}from'../consts'exportdefaultfunctionMainSlider() {//items是渲染数据的数组constscreenWidth=useDeviceSize().width;return(<SliderscreenWidth={screenWidth()}dataLength={items.length...
// fetches a user and streams content as soon as possible const [user] = createResource(() => params.id, fetchUser); // fetches a user but only streams content after this resource has loaded const [user] = createResource(() => params.id, fetchUser, { deferStream: true });...
token?:stringid?:stringsetToken:(token:string) =>voidsetId:(id:string) =>void}//这里使用zustand的persist中间件来进行持久化exportconstuseSessionStore =create( persist<Session>((set, get) =>({setToken:(token:string) =>set({ token }),setId:(id:string) =>set({ id }) ...
token?:stringid?:stringsetToken:(token:string) =>voidsetId:(id:string) =>void}//这里使用zustand的persist中间件来进行持久化exportconstuseSessionStore =create( persist<Session>((set, get) =>({setToken:(token:string) =>set({ token }),setId:(id:string) =>set({ id }) ...
Use clientOnly without isolating component in its own file solidstart #840 opened Aug 7, 2024 by MengLinMaker 3 Clarify why and how nested routing help wanted solid-router #841 opened Aug 7, 2024 by gxxcastillo 4 In the session example code, should 'event.params.userId' be just...
export const useSessionStore = create( persist<Session>( (set, get) => ({ setToken: (token: string) => set({ token }), setId: (id: string) => set({ id }) }), { name: "session-store", getStorage: () => localStorage ...
需要注意的是这里使用的是solid-zustand,而不是zustandimport{persist}from"zustand/middleware"//这里定义了session的类型interfaceSession{token?:stringid?:stringsetToken:(token:string)=>voidsetId:(id:string)=>void}//这里使用zustand的persist中间件来进行持久化exportconstuseSessionStore=create(persist<...