what he said word-by-word:
"let's do the exactly same thing, say accounts, await, window, ethereum request get accounts and we're gonna set the accounts to the first account on the list, and then that's gonna set it the in component state of the parent component and we're gonna pass it back in here with this account like this
related code snippets:
App.js
...
function App() {
const [account, setAccount] = useState(null)
const loadBLockchainData = async () => {
const provider = new ethers.providers.Web3Provider(window.ethereum)
}
useEffect(() => {
loadBLockchainData()
})
return (
<div>
<Navigation account={account} setAccount={setAccount}/>
<div className='cards__section'>
<h3>Welcome to Millow</h3>
</div>
</div>
);
}
...
Navigation.js
...
const Navigation = ({ account, setAccount }) => {
const connectHandler = async () =>{
const accounts = await window.ethereum.request({method: 'eth_requestAccounts'});
setAccount(accounts[0])
}
...
video: https://youtu.be/C4blK6X-D_4?t=6298
what he said word-by-word:
"let's do the exactly same thing, say accounts, await, window, ethereum request get accounts and we're gonna set the accounts to the first account on the list, and then that's gonna set it the in component state of the parent component and we're gonna pass it back in here with this account like this
related code snippets:
App.js
Navigation.js
video: https://youtu.be/C4blK6X-D_4?t=6298