4
2 Comments

Redux and Drizzle (Day 75)

Image from Oak Tree Software

I've spent most of today reading the docs for Redux and Drizzle. Also, review the memoize concept, trying to figure out a way to cache calls to the blockchain, and simplify the page level logic a bit. I'll get more hands-on tomorrow.

react-redux now supports React Hooks, allows access to the global state object and dispatches without using connect(). It requires version ^7.1 though, and we are still on 6.0. I haven't read the changelogs yet, not sure if there're any breaking changes (usually there are between major version bumps), so we'll be keeping the connect() calls.

We also make API calls to create legal documents from the client. Right now, it is handled at the page level--the page will be in a loading state before the doc gets ready in some cases. Would it be better if we dispatch an action, and store the (link to the) doc in the global state?

We also have async calls to Ethereum contract reads and writes. This can be handled as described in the paragraph above, too. The current drawback is that we have to manage the transaction state at the page level. It is possible to use Drizzle to sync the transaction states, and Drizzle uses a redux store so the pattern should be quite consistent. Also, if we move it to the Redux store, it does get some kind of caching, which will improve the rendering speed tremendously. I have a worry, however, since different web3 versions could break the app in weird ways, so I may move the Drizzle change to the backlogs for now.

These are some of the questions I need to figure out tomorrow.

Do you have any suggestions or experiences you can share, fellow indie-hackers? Especially, what do you think is the best way to cache Ethereum calls?

on June 18, 2020
  1. 1

    hi @titans , i'm trying to build a similar app (similar toolchain), using react-redux-drizzle-hooks, and also requires a firestore integration. I'd love to take a look at your code for some structural ideas of how to bring it all together. would be much help. Currently, my issue is I cant figure out how to provide an initialState to the drizzleStore, while generating the store itself. I'm using drizzle's store as the default store for both drizzle and redux.