Connecting wallets
wallets: are anything that let us store sceret keys securely and sign transactions.
- they do more than just storing and the name is kinda confusing.
- they allow to suggest transaction signing in safe way.
Solana wallet adapter
- there are tons of wallets out there, doing things their own way.
- thanks to solana-wallet-adapter we dont have do it for each. It has the support all major wallets.
- wallet-adapter-react-ui: takes care of ui.(listing, selecting and connecting)
also learned about tree shaking
solana-wallet-adapteruses tree shaking, what this means is: When we use bundler likeroll-uporwebpackto do a production release, it analyzes the code (imports and exports) then based on that any dead code will be removed(tree shaken).
also learned about useMemo hook.
- what it does it, it loads the stuff when one of the dependecies change. This brings me to another question, how is this different from
useEffectwhich kinda does the same thing. - okay, here is what i found,
useEffectkinda does one additional render than use memeouseMemo. ex:
1 | unction expensiveCalculation(x) { return x + 1; }; |
say
xwas 0, first. Here is what happpens if we run the above function inuseEffect, first it will do a render withxbeing set tonullthen immediately adds it to a queqe withxset to0then it renders again.but
useMemoavoids that extra render, and it intially renders it withxset to0.