Content pfp
Content
@
0 reply
0 recast
0 reaction

Mike pfp
Mike
@starrdev
I'm having issues passing state between different components. https://github.com/airswap/frames/blob/fix-otcurl-input/templates/next-starter-with-examples/app/frames/frames.ts First I declared my initial state in the frames.ts file: `import { createFrames } from "frames.js/next"; export type State = { otcUrl: string; } export const frames = createFrames<State>({ basePath: "/frames", initialState: { otcUrl: "" }, debug: process.env.NODE_ENV === "development", });` https://github.com/airswap/frames/blob/fix-otcurl-input/templates/next-starter-with-examples/app/frames/route.tsx Then I update state when input changes in route.tsx: `const currentState = ctx.state; const updatedState = { ...currentState, otcUrl: ctx.message?.inputText || undefined }` https://github.com/airswap/frames/blob/fix-otcurl-input/templates/next-starter-with-examples/app/frames/url_list/route.tsx Then I extract state from the context object, but it's not working. `const otcUrl = ctx.state.otcUrl`
2 replies
0 recast
0 reaction

David Furlong pfp
David Furlong
@df
did you figure it out? need more help?
1 reply
0 recast
0 reaction

Mike pfp
Mike
@starrdev
I'm still stuck. The issue now is that I cannot get state to persist when going to a new frame. https://github.com/airswap/frames/blob/fix-otcurl-input/templates/next-starter-with-examples/app/frames/route.tsx In my main route.tsx file, when you fill in the text input and click on the button, state gets updated, but when I try to access state in the next frame, `frame/route1/route.tsx`, I'm unable to access state from `ctx`
0 reply
0 recast
0 reaction