import { createContext, JSX } from 'solid-js'; import { createStore } from "solid-js/store"; import { Stop } from './types'; export interface AppContextStore { getDisplayedStops: () => Stop[]; setDisplayedStops: (stops: Stop[]) => void; }; export const AppContextContext = createContext(); export function AppContextProvider(props: { children: JSX.Element }) { type Store = { displayedStops: Stop[]; }; const [store, setStore] = createStore({ displayedStops: [], }); const getDisplayedStops = (): Stop[] => { return store.displayedStops; } const setDisplayedStops = (stops: Stop[]): void => { console.log("setDisplayedStops=", stops); // setStore((s: Store) => { setStore('displayedStops', stops); // return s; // }); } return ( {props.children} ); };