<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dean</title>
    <description>The latest articles on DEV Community by Dean (@thestriver).</description>
    <link>https://dev.to/thestriver</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F969117%2Febb0cc6e-b351-4c3c-bf51-d2c0517b2659.jpg</url>
      <title>DEV Community: Dean</title>
      <link>https://dev.to/thestriver</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thestriver"/>
    <language>en</language>
    <item>
      <title>Build Your First Personal AI Assistant with JavaScript in 5 Minutes (For Free 🤯) - Start The Timer!</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Tue, 17 Jun 2025 17:15:42 +0000</pubDate>
      <link>https://dev.to/thestriver/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-start-the-timer-40pp</link>
      <guid>https://dev.to/thestriver/build-your-first-personal-ai-assistant-with-javascript-in-5-minutes-for-free-start-the-timer-40pp</guid>
      <description>&lt;h2&gt;
  
  
  🚀 The Whole AI Hype: Why JS Devs Should Care
&lt;/h2&gt;

&lt;p&gt;Since ChatGPT was released in late 2022, the AI space has been growing at a super impressive speed. Companies are raising hundreds of millions of dollars, state-of-the-art AI models are being released literally every day, and mindblowing products are being introduced daily. &lt;/p&gt;

&lt;p&gt;While Python has been the primary language of the AI revolution, JavaScript developers can also benefit significantly from this industry growth. Why? Many startups are now prepared to bring their AI research to production, and what better way to ship products faster than by using the language of the web: JavaScript! &lt;/p&gt;

&lt;p&gt;Don't believe me? You can do a quick search for the rise in &lt;strong&gt;product engineering&lt;/strong&gt; job roles over the past year. So if you're new to building AI powered apps, let's get started.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmjryakto1w3z7gmiu8fj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmjryakto1w3z7gmiu8fj.png" alt="Starting the timer" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ⏱️ Let’s Start the Timer: Setting Up Your Dev Environment
&lt;/h2&gt;

&lt;p&gt;Here’s what you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Node.js (v18+ recommended)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A code editor (VS Code, WebStorm, or whatever you love)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;npm (comes with Node)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An API key (but stay tuned for a free hack!)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Install the OpenAI SDK:&lt;br&gt;
&lt;code&gt;npm install openai&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  💸 Wait, Isn’t This Supposed to Be Free?
&lt;/h3&gt;

&lt;p&gt;I know I said you can build this for free, but the official OpenAI API key costs money to get started. Stay with me, and I'll reveal a cool, legit open secret on how you can use hundreds of AI models for free, including some that rival OpenAI models in terms of performance.&lt;/p&gt;

&lt;p&gt;Okay, time is running out, let's build our personal research assistant with inbuilt search support!&lt;/p&gt;
&lt;h2&gt;
  
  
  Your Personal AI Assistant with JavaScript
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import OpenAI from "openai";
const client = new OpenAI();

const completion = await client.chat.completions.create({
    model: "gpt-4o-search-preview",
    web_search_options: {},
    messages: [{
        "role": "user",
        "content": "Give me a quick summary of a trending good news story"
    }],
});

console.log(completion.choices[0].message.content);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You should get a response like below after running &lt;code&gt;node index.js&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In April 2025, researchers in Miami, Florida, developed BIOCAP tiles—a 3D-printed modular system designed to support marine life and reduce wave impact along urban seawalls. These tiles are set to be installed at Morningside Park, aiming to protect marine ecosystems from coastal erosion.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Voila! Now you have your own personal AI assistant that you can use for coding, research, and much more. You can also create a frontend React app that queries this setup as an API route or even entirely within your frontend app. &lt;/p&gt;
&lt;h2&gt;
  
  
  Give It Wings — The Free Model Hack
&lt;/h2&gt;

&lt;p&gt;Here’s the hack: OpenRouter. It’s a unified API gateway that lets you access hundreds of AI models (including many for free) using the same OpenAI-compatible sdk we installed. You just swap the base URL and use their free models, which you can see &lt;a href="https://openrouter.ai/models?order=pricing-low-to-high" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For this tutorial, we will use the latest Llama-4 Maverick model from Meta. Here's the full code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: "https://openrouter.ai/api/v1",
  apiKey: "&amp;lt;OPENROUTER_API_KEY&amp;gt;"
});

async function main() {
  const completion = await openai.chat.completions.create({
    model: "meta-llama/llama-4-maverick:free",
    messages: [
      {
        role: "user",
        content: "Give me a quick summary of a trending good news story"
      }
    ],
  });

  console.log(completion.choices[0].message.content);
}

main();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should also get an almost similar result when you run the code.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Here's a trending good news story:&lt;br&gt;
&lt;strong&gt;Global Efforts to Protect Endangered Sea Turtles Paying Off&lt;/strong&gt;&lt;br&gt;
Conservation efforts to protect endangered sea turtles are showing significant results worldwide. Thanks to the collaborative efforts of governments, NGOs, and local communities, many sea turtle species are experiencing a notable increase in population.&lt;/p&gt;

&lt;p&gt;One notable example is the Kemp's ridley sea turtle, which was on the brink of extinction in the 1980s with only around 400 nesting females. Conservation efforts, including the establishment of protected nesting sites and reduction of bycatch in fishing gear, have led to a remarkable recovery. In 2020, the number of Kemp's ridley nesting females reached a record high of over 22,000.&lt;/p&gt;

&lt;p&gt;Similarly, conservation efforts in the Great Barrier Reef have led to a significant increase in the population of green turtles. The number of nesting turtles has risen by over 50% since 2000, thanks to efforts to reduce pollution, protect nesting sites, and promote sustainable fishing practices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s it. You’re now running a personal AI assistant at no cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Final Thoughts
&lt;/h2&gt;

&lt;p&gt;With tools like OpenRouter, you don’t need a fat wallet to build something amazing. &lt;/p&gt;

&lt;p&gt;If you build something cool or have any questions, please leave a comment and tag me. I would love to help in any way! If you found this article useful, add a reaction and share it with your peers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Support Me ❤️❤️
&lt;/h2&gt;

&lt;p&gt;I'm building an SDK called &lt;a href="https://github.com/docuglean-ai/docuglean" rel="noopener noreferrer"&gt;Docuglean&lt;/a&gt; that helps you process and extract key information from all types of documents efficiently using AI models.&lt;/p&gt;

&lt;p&gt;Please give the project a ⭐ on GitHub, and I would be super happy :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/docuglean-ai/docuglean" rel="noopener noreferrer"&gt;Give Docuglean a 🌟 on GitHub.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>The Future Of Work: Being On The Good Side Of AI The Centaur Way</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Wed, 23 Nov 2022 21:30:05 +0000</pubDate>
      <link>https://dev.to/thestriver/the-future-of-work-being-on-the-good-side-of-ai-the-centaur-way-4n13</link>
      <guid>https://dev.to/thestriver/the-future-of-work-being-on-the-good-side-of-ai-the-centaur-way-4n13</guid>
      <description>&lt;h2&gt;Only The Centaurs Win&lt;/h2&gt; 

&lt;p&gt;Note: An AI wrote parts of this article. Try to guess which :)&lt;br&gt;
&lt;br&gt;&lt;br&gt;
In the first chapter of Smarter Than You Think, the author, Clive Thompson, narrated the story of the rise, fall and rise of Kasparov, a chess grand champion. &lt;/p&gt;

&lt;p&gt;The main takeaway depicted a battle between the past and the future. In 1997, IBM's Deep Blue supercomputer beat the world champion, Kasparov, in a game of chess. The defeat was devastating, with media outlets terming it the evil triumph of AI over the brain.&lt;/p&gt;

&lt;p&gt;But Kasparov did something beautiful after that. He learned the ways of the supercomputer partnering with the AI giving birth to what's now called Advanced Chess.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Software is eating the world. And to be spared, one needs to pander to its desires, master them and, in turn, use them to achieve one's goals.&lt;/p&gt;

&lt;p&gt;That's why it's saddening to see an entrenched traditional system fight futility against innovation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1485827404703-89b55fcc595e%3Fixlib%3Drb-4.0.3%26ixid%3DMnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8%26auto%3Dformat%26fit%3Dcrop%26w%3D1470%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1485827404703-89b55fcc595e%3Fixlib%3Drb-4.0.3%26ixid%3DMnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8%26auto%3Dformat%26fit%3Dcrop%26w%3D1470%26q%3D80" width="1470" height="980"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You find numerous examples every day. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Office workers revolting against computerized systems brought to replace them. &lt;/li&gt;
&lt;li&gt;Taxi drivers protesting against share-riding apps. &lt;/li&gt;
&lt;li&gt;DVD companies employing cutthroat tactics to destroy streaming companies. 
&lt;/li&gt;
&lt;li&gt;Hotels scheming against AirBnB.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All exercises in futility. What is certain is that sooner or later,  innovation - in this case, AI always win.&lt;/p&gt;

&lt;p&gt;The smart ones are those who stay on the good side.&lt;/p&gt;

&lt;h2&gt;Being On The Good Side Of AI&lt;/h2&gt;

&lt;p&gt;Interestingly, we all are slowly becoming centaurs. We can only perform many of our daily activities by using AI-powered products. Google search engine to quickly make decisions, Facebook and Instagram to flaunt our emotional state et al. It begs the question. If we can embrace technology in mundane aspects of our lives, why can't we embrace it in something more important than that: our means of sustenance?&lt;/p&gt;

&lt;h3&gt;A reminder: A Journey to 2022&lt;/h3&gt;

&lt;p&gt;We often know the urgency of a situation but don't take action. Bystander effect? For example, traditional media behemoths all saw the birth of the Internet but refused to participate actively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What You Can Do&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're a college graduate, then Bill Gates' viral twitter thread is probably the best for you. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;New college graduates often ask me for career advice. I was lucky to be in my early 20s when the digital revolution was just getting underway, and Paul Allen and I had the chance to help shape it. (Which explains my lack of a college degree—I left school because we were afraid the revolution would happen without us.) If I were starting out today and looking for the same kind of opportunity to make a big impact in the world, I would consider three fields.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote data-lang=" en"&gt;
&lt;p&gt;2/ AI, energy, and biosciences are promising fields where you can make a huge impact. It's what I would do if starting out today.&lt;/p&gt; - Bill Gates (@BillGates) &lt;a href="https://twitter.com/BillGates/status/864100691870048256" rel="noopener noreferrer"&gt;May 15, 2017&lt;/a&gt;
&lt;/blockquote&gt;

&lt;p&gt;And if you're already working, your best bet is to improve your skills and switch career lines constantly. &lt;/p&gt;

&lt;p&gt;In summary, GoDaddy's CEO advice is probably the best one-size-fit-all advice:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I posit that today most people choose their career at the conjunction of "what they are good at" and "what pays the most," with little consideration for doing what they love. But the same Applied AI that's driving job-killing automation can simultaneously help individuals follow their entrepreneurial dreams. Dreams that are tied to a third circle in the Venn diagram: "doing what they love."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;THE DAO and the Blockchain&lt;/h2&gt;

&lt;p&gt;A more radical case of the future of work is the DAO - Decentralized autonomous organization. It's an automated organization that runs on smart contracts. No CEO. No Board of Directors. No Structure at all. All managed on the blockchain.&lt;/p&gt;

&lt;p&gt;Why this sounds like an almost impossible scenario, a few crypto communities are being successfully running based on these smart contracts.&lt;/p&gt;

&lt;p&gt;Imagine a happy workplace with no bosses! Utopia!&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;It's easy to get too comfortable with the current work styles and ignore the sweeping tide of AI. More and more companies spend billions of dollars yearly to improve their competitive advantage with artificial intelligence.&lt;/p&gt;

&lt;p&gt;Although there is a never-ending debate as to whether automation kills or creates jobs, there is no doubt that those who will prosper in the future are those with a wide variety of constantly updated skills.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be a Centaur.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Inspirations - &lt;a href="https://alumni.berkeley.edu/california-magazine/just-in/2015-06-08/good-bad-and-robot-experts-are-trying-make-machines-be-moral" rel="noopener noreferrer"&gt;1&lt;/a&gt;  - &lt;a href="https://www.forbes.com/sites/joshbersin/2016/09/21/the-future-of-work-its-already-here-and-not-as-scary-as-you-think/#3c0c77f04bf5" rel="noopener noreferrer"&gt;2&lt;/a&gt; - &lt;a href="https://medium.com/@Blakei/artificial-intelligence-and-the-future-of-work-abacce6328d6" rel="noopener noreferrer"&gt;3&lt;/a&gt;  - &lt;a href="https://www.theguardian.com/society/2015/nov/29/five-ways-work-will-change-future-of-workplace-ai-cloud-retirement-remote" rel="noopener noreferrer"&gt;4&lt;/a&gt;  - &lt;a href="https://venturebeat.com/2017/04/23/companies-of-the-future-no-ceo-no-boss-managed-by-blockchain/" rel="noopener noreferrer"&gt;5&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Over to you:&lt;/h2&gt;

&lt;p&gt;So tell me, have you switched jobs to a different field? And what career skills have you developed outside (formal) college education?&lt;/p&gt;

&lt;p&gt;I would love to hear from you. :)&lt;/p&gt;

</description>
      <category>ai</category>
      <category>web3</category>
      <category>futureofwork</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Add a web3 connect button to your React App with TypeScript and Metamask.</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Wed, 09 Nov 2022 06:43:41 +0000</pubDate>
      <link>https://dev.to/thestriver/add-a-web3-connect-button-to-your-react-app-with-typescript-and-metamask-2bkm</link>
      <guid>https://dev.to/thestriver/add-a-web3-connect-button-to-your-react-app-with-typescript-and-metamask-2bkm</guid>
      <description>&lt;p&gt;&lt;a href="https://metamask.io/" rel="noopener noreferrer"&gt;Metamask&lt;/a&gt; is the most popular cryptocurrency wallet with over &lt;a href="https://consensys.net/blog/press-release/metamask-surpasses-10-million-maus-making-it-the-worlds-leading-non-custodial-crypto-wallet/" rel="noopener noreferrer"&gt;10 Million monthly active users&lt;/a&gt;. Available as a browser extension and mobile app, Metamask provides key functionalities that make it easy to interact with the Ethereum blockchain and other notable chains like Binance, Avalanche, and Polygon. Web3 developers may use these capabilities to power decentralized apps (dApps), allowing users to perform blockchain-based transactions securely with a single sign-on.&lt;/p&gt;

&lt;p&gt;In this article, we will use TypeScript to add a Metamask connect button to a basic React project. Google's Firebase social login, which allows developers to build apps that authenticate users using their Google, Facebook, GitHub, and Twitter accounts, is a similar traditional web equivalent.&lt;/p&gt;

&lt;p&gt;Let's get started. &lt;/p&gt;

&lt;h2&gt;Create React App&lt;/h2&gt;

&lt;p&gt;We will use the &lt;a href="https://create-react-app.dev/docs/adding-typescript/" rel="noopener noreferrer"&gt;official Create-react app documentation&lt;/a&gt; to add TypeScript to a react app. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npx create-react-app typescript-metamask --template typescript 
cd typescript-metamask
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This command will create a basic react app, as shown below. If you're using Visual Studio Code, you can run &lt;em&gt;code . &lt;/em&gt;to launch the editor direct from the terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2Fj8aXhws1DBF2hWaitRVgILcf_swLO0H3aQo82C22E_ab837xH0_b1X7MKU1coWCBijJ-qa6cyKvgnJU4swAqvbIK4wGgUPjJmfEgSs9g6OD7zAdPBgjm9p6s336q8qOYEz_LHMHb" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2Fj8aXhws1DBF2hWaitRVgILcf_swLO0H3aQo82C22E_ab837xH0_b1X7MKU1coWCBijJ-qa6cyKvgnJU4swAqvbIK4wGgUPjJmfEgSs9g6OD7zAdPBgjm9p6s336q8qOYEz_LHMHb" alt="" width="937" height="591"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Consequently, our file structure will look like below. &lt;/p&gt;

&lt;p&gt;&amp;gt; src/App.tsx&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh6.googleusercontent.com%2F3SFc0sNkP03Pf6Ytxzno2nUxvajiZp7ob4PE09HV6kZ_iVWBI5V-_tqrG_7ALuRhn9CxDosXMYKVYdYYHnxvwGWZtBFBUiHJYkCHbQi2QfbwMmw4YINipWRD22K2iDasgWnZZSic" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh6.googleusercontent.com%2F3SFc0sNkP03Pf6Ytxzno2nUxvajiZp7ob4PE09HV6kZ_iVWBI5V-_tqrG_7ALuRhn9CxDosXMYKVYdYYHnxvwGWZtBFBUiHJYkCHbQi2QfbwMmw4YINipWRD22K2iDasgWnZZSic" alt="" width="937" height="591"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Does the user have Metamask Installed?&lt;/h2&gt;

&lt;p&gt;Next, we will use the &lt;a href="https://docs.metamask.io/guide/ethereum-provider.html" rel="noopener noreferrer"&gt;Metamask window.ethereum API&lt;/a&gt; to check if the user has Metamask installed. To call and store the API returns, we will need two React Hooks - useState and useEffect.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import { useEffect, useState } from "react";

const App: React.FC = () =&amp;gt; {
 const [isMetamaskInstalled, setIsMetamaskInstalled] = useState&amp;lt;boolean&amp;gt;(false);
 const [account, setAccount] = useState&amp;lt;string | null&amp;gt;(null);

useEffect(() =&amp;gt; {
   if((window as any).ethereum){
     //check if Metamask wallet is installed
     setIsMetamaskInstalled(true);
   }
 },[]);
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Does the User have an Ethereum wallet/account?&lt;/h2&gt;

&lt;p&gt;After that, we need to verify if the user has an Ethereum account. To do this, we will query Metamask's &lt;a href="https://docs.metamask.io/guide/rpc-api.html#eth-requestaccounts" rel="noopener noreferrer"&gt;eth_requestAccounts&lt;/a&gt; function, which returns an Array of strings - string [].  &lt;/p&gt;

&lt;p&gt;If the user has an Ethereum account, we'll create a function to retrieve and store the wallet address.   &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;//Does the User have an Ethereum wallet/account?
 async function connectWallet(): Promise&amp;lt;void&amp;gt; {
   //to get around type checking
   (window as any).ethereum
     .request({
         method: "eth_requestAccounts",
     })
     .then((accounts : string[]) =&amp;gt; {
         setAccount(accounts[0]);
     })
     .catch((error: any) =&amp;gt; {
         alert(`Something went wrong: ${error}`);
     });
 }&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And also display the connected wallet address.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;return (
   &amp;lt;div className="App"&amp;gt;
     &amp;lt;header className="App-header"&amp;gt;
       &amp;lt;img src={logo} className="App-logo" alt="logo" /&amp;gt;
       &amp;lt;p&amp;gt;
         ETH wallet connected as: {account}
       &amp;lt;/p&amp;gt;
     &amp;lt;/header&amp;gt;
   &amp;lt;/div&amp;gt;
 );&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If the user does not have an Ethereum account, we can have the app prompt the user to install Metamask crypto wallet and create and add an Ethereum account to your wallet.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if (ethereumAccount === null) {
   return (
     &amp;lt;div className="App App-header"&amp;gt;
       {
         isMetamaskInstalled ? (
           &amp;lt;div&amp;gt;
             &amp;lt;img src={logo} className="App-logo" alt="logo" /&amp;gt;
             &amp;lt;button onClick={connectMetamaskWallet}&amp;gt;Connect Your Metamask Wallet&amp;lt;/button&amp;gt;
           &amp;lt;/div&amp;gt;
         ) : (
           &amp;lt;p&amp;gt;Install Your Metamask wallet&amp;lt;/p&amp;gt;
         )
       }
 
     &amp;lt;/div&amp;gt;
   );
 }&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here's the final &lt;em&gt;App.tsx&lt;/em&gt; version:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import { useEffect, useState } from "react";
import logo from './logo.svg';
import './App.css';
 
const App: React.FC = () =&amp;gt; {
 const [isMetamaskInstalled, setIsMetamaskInstalled] = useState&amp;lt;boolean&amp;gt;(false);
 const [ethereumAccount, setEthereumAccount] = useState&amp;lt;string | null&amp;gt;(null);
 
 useEffect(() =&amp;gt; {
   if((window as any).ethereum){
     //check if Metamask wallet is installed
     setIsMetamaskInstalled(true);
   }
 },[]);
 
 //Does the User have an Ethereum wallet/account?
 async function connectMetamaskWallet(): Promise&amp;lt;void&amp;gt; {
   //to get around type checking
   (window as any).ethereum
     .request({
         method: "eth_requestAccounts",
     })
     .then((accounts : string[]) =&amp;gt; {
       setEthereumAccount(accounts[0]);
     })
     .catch((error: any) =&amp;gt; {
         alert(`Something went wrong: ${error}`);
     });
 }
 
 if (ethereumAccount === null) {
   return (
     &amp;lt;div className="App App-header"&amp;gt;
       {
         isMetamaskInstalled ? (
           &amp;lt;div&amp;gt;
             &amp;lt;img src={logo} alt="logo" /&amp;gt;
             &amp;lt;button onClick={connectMetamaskWallet}&amp;gt;Connect Your Metamask Wallet&amp;lt;/button&amp;gt;
           &amp;lt;/div&amp;gt;
         ) : (
           &amp;lt;p&amp;gt;Install Your Metamask wallet&amp;lt;/p&amp;gt;
         )
       }
 
     &amp;lt;/div&amp;gt;
   );
 }
 
 
 return (
   &amp;lt;div className="App"&amp;gt;
     &amp;lt;header className="App-header"&amp;gt;
       &amp;lt;img src={logo} className="App-logo" alt="logo" /&amp;gt;
       &amp;lt;p&amp;gt;
         ETH wallet connected as: {ethereumAccount}
       &amp;lt;/p&amp;gt;
     &amp;lt;/header&amp;gt;
   &amp;lt;/div&amp;gt;
 );
}
 
export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The final version before a user connect:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh6.googleusercontent.com%2FSYHpVih-sKxqNwenoO5q6t_ZnQhWOSw-u1lWGtfb4EW2AUQbMOelTPjqX-UKwvnypDCXW48xfp9KnWI0KHy8ZN1CFed26Rmp24E6JLbugMxiS43M3xNmlfwP76IA0GOVjS7G1kD0" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh6.googleusercontent.com%2FSYHpVih-sKxqNwenoO5q6t_ZnQhWOSw-u1lWGtfb4EW2AUQbMOelTPjqX-UKwvnypDCXW48xfp9KnWI0KHy8ZN1CFed26Rmp24E6JLbugMxiS43M3xNmlfwP76IA0GOVjS7G1kD0" alt="" width="899" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After a user connects:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh4.googleusercontent.com%2F7voSgROUbVVlK8FYm4wa8EPjBvW7YSJkenSqy81kFFvQDHHtezEUgD_PdhzZii9bBaKfr4QJC0VYfauEf1GrC3xxuye_WOd0uG7NcgzXk_NOUzDcNhNfpscAOYCM1amAvM3P8hcq" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh4.googleusercontent.com%2F7voSgROUbVVlK8FYm4wa8EPjBvW7YSJkenSqy81kFFvQDHHtezEUgD_PdhzZii9bBaKfr4QJC0VYfauEf1GrC3xxuye_WOd0uG7NcgzXk_NOUzDcNhNfpscAOYCM1amAvM3P8hcq" alt="" width="1415" height="629"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;That's all. Metamask provides powerful APIs web3 React developers can query when building their Ethereum-based dApps. &lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>web3</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
