Menu

async/await logic and side effects outside React hooks

Reddit r/reactjs·u/arkhamdivider·4 days ago
#KZxFsnnK
#event#redux#async#await#logic
Reading 0:00
15s threshold

I work on a React SDK for chats that our company embeds into its web and mobile products. Each product has its own settings, and the code grew fast. When I joined, the team was starting a refactor. The main problems:

the flow was hard to follow

most of the logic lived inside React hooks

The constraint. The SDK runs inside host apps, sometimes via module federation. Every dependency can clash with the host's version, so our size and dependency budget is tiny. What we considered:

redux-saga : I like it, but it's too big, and Redux could conflict with the consumers' own Redux.

RxJS : it solves only part of the problem, because we still need a state manager. It's also a new paradigm for a team with few senior people.

effector : the team knows it, but it has a static graph and the same version-conflict risk.

Effect : little known in our market, and it would need most of the SDK rewritten.

So we started with a plain event bus that can carry any parameters.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.