SolidJSS
SolidJSโ€ข3y agoโ€ข
3 replies
tourist

on store change

is it possible to run a function after a store value has been changed?
const Main = () => {
    const app = useFirebaseApp();
    const auth = getAuth(app);
    const state = useAuth(auth);
    const db = getFirestore(app);

    let todos = null;
    createEffect(on(state, () => {
        if (!state.loading && state.data !== null) {
            todos = useFirestore(doc(db, "todos", state.data?.uid));
        }
    }));
i want to access the document todos/uid but the uid will only exist after firebase resolves whether the user is currently logged in and what i have here is sort of what i'm looking for except on( expects a reactive value
Was this page helpful?