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-adapter
uses tree shaking, what this means is: When we use bundler likeroll-up
orwebpack
to 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
useEffect
which kinda does the same thing. - okay, here is what i found,
useEffect
kinda does one additional render than use memeouseMemo
. ex:
1 | unction expensiveCalculation(x) { return x + 1; }; |
say
x
was 0, first. Here is what happpens if we run the above function inuseEffect
, first it will do a render withx
being set tonull
then immediately adds it to a queqe withx
set to0
then it renders again.but
useMemo
avoids that extra render, and it intially renders it withx
set to0
.