Content
@
0 reply
0 recast
0 reaction
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
Samuel ツ
@samuellhuber.eth
Doesn’t state need to go into your return as well?
1 reply
0 recast
0 reaction
Mike
@starrdev
Nope, in React state always gets declared within a functional, but before the return statement. My issue now is I'm not able to access state between different frames. State doesn't persist
1 reply
0 recast
0 reaction