How to use the @reactorx/core.Store.create function in @reactorx/core

To help you get started, we’ve selected a few @reactorx/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github querycap / reactorx / @reactorx / request / src / __tests__ / useRequesting$.spec.tsx View on Github external
it("loading", async () => {
    const actor = getApiList.with(undefined);

    function Loading() {
      const requesting$ = useRequesting$();
      const loading = useSelector(requesting$);
      return <span id="{&quot;loading&quot;}">{`${loading}`}</span>;
    }

    const store$ = Store.create({});

    const node = await mount(
      
        
      ,
    );

    for (let i = 0; i &lt; 1000; i++) {
      const $loading = node.querySelector("#loading")!;

      act(() =&gt; {
        actor.started.invoke(store$);
      });

      expect($loading.innerHTML).toContain("true");
github querycap / reactorx / @reactorx / router / src / __tests__ / ReactorxRouter.spec.tsx View on Github external
it("renders the first  that matches the URL", async () =&gt; {
    const store$ = Store.create({
      $$location: {
        pathname: "/three",
        search: "",
        hash: "",
        state: undefined,
      },
    });

    const node = await mount(
github querycap / reactorx / @reactorx / persister / src / __tests__ / index.spec.tsx View on Github external
it("flow", async () =&gt; {
    const persister = createPersister({
      name: "test",
      driver: memoryStorageDriver._driver,
    });

    const store$ = Store.create({ ping: 0, pong: 0 });

    function App() {
      useEffect(() =&gt; persister.connect(store$));
      usePersist("ping");
      return null;
    }

    await mount(
      
        
      ,
    );

    expect((store$.getState() as any)[persistedKeys] || {}).toEqual({
      ping: {
        key: "ping",
github querycap / reactorx / @reactorx / request / src / __tests__ / index.spec.tsx View on Github external
return new Promise((resolve) =&gt; {
      setTimeout(() =&gt; {
        resolve({
          status: StatusOK,
          statusText: "OK",
          data: {
            "100": "https://assets-cdn.github.com/images/icons/emoji/unicode/1f4af.png?v8",
          },
          headers: {},
          config,
        });
      }, 500);
    });
  };

  const store$ = Store.create({});

  store$.epicOn(
    composeEpics(
      createCombineDuplicatedRequestEpic(),
      createRequestEpic({
        baseURL: "https://api.github.com",
        adapter: mock,
      }),
    ),
  );

  function useEmoijs() {
    const [emoijs, updateEmoijs] = useState({});

    const [request] = useRequest(getEmojis);