Effect CommunityEC
Effect Community2y ago
2 replies
Madyan

Running a Function Directly in Rx Without React Hook

Is it possible to run a function in rx without using a react hook?

I know I could do the code below, but as I don't care about the function result, is it possible to simplify it by running the function directly?

// we have a BookingStore layer

const loadMore$ = myRuntime.fn(() => BookingStore.loadMore())

const MyPage = () =>
  const loadMore = useRxSet(loadMore$)

  return (
    <button onClick={
      () => loadMore()
      // instead, can I trigger BookingStore.loadMore() directly here?
    }>...</button>
  )
Was this page helpful?