aqtata

jotai 的 atom 怎么调用自身?

  •  
  •   aqtata · Feb 2, 2023 · 959 views
    This topic created in 1201 days ago, the information mentioned may be changed or developed.

    定义的 atom 大概是这样子

    export const startTaskAtom = atom(null, async (get, set) => {
        console.log('startTaskAtom');
        // some code
        if (condition) {
            set(startTaskAtom);
        }
    }
    

    我期望在条件达成时调用自身,像上面那样用set去调用虽然没有报错,但也没有执行。 还是说这样的思路是错的?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2505 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:39 · PVG 23:39 · LAX 08:39 · JFK 11:39
    ♥ Do have faith in what you're doing.