<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Wilson Oluwatomisin on Medium]]></title>
        <description><![CDATA[Stories by Wilson Oluwatomisin on Medium]]></description>
        <link>https://medium.com/@tommywilson972?source=rss-e01d491da1aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5C2SY6Bzagv7-DE7oZgfeg.jpeg</url>
            <title>Stories by Wilson Oluwatomisin on Medium</title>
            <link>https://medium.com/@tommywilson972?source=rss-e01d491da1aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:22:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tommywilson972/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Stop Migrating to Next js:How I Rendered Social Media Metadata with Express]]></title>
            <link>https://medium.com/@tommywilson972/stop-migrating-to-next-js-how-i-rendered-social-media-metadata-with-express-7b6a07d14b6e?source=rss-e01d491da1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b6a07d14b6e</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Wilson Oluwatomisin]]></dc:creator>
            <pubDate>Sat, 17 Jan 2026 23:19:29 GMT</pubDate>
            <atom:updated>2026-01-17T23:35:32.376Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a5kcDAXC97dqlu5slA7IJQ.png" /></figure><h3>Introduction</h3><p>Social media previews matter. When a product link is shared on WhatsApp, Twitter (X), Facebook, or Slack, the <strong>title, description, and image</strong> shown can decide whether someone clicks or ignores it.</p><p>In one of my recent projects, i faced a common challenge:</p><p><em>Social media bots were not picking up dynamic product metadata because our app was a client-side React SPA.</em></p><p>The usual recommendation is <strong>“Just migrate to Next.js.”</strong></p><p>But migrating a mature React app is expensive, risky, and often tedious. Instead, i solved the problem by introducing a <strong>lightweight Express server</strong> that dynamically renders HTML <strong>only for social media bots</strong>, while keeping the rest of the app fully client-side.</p><p>This article explains:</p><p>— The problem with metadata in SPAs.</p><p>— The Express-based solution i implemented.</p><p>— A step-by-step implementation guide.</p><p>— Why you <em>don’t</em> need to migrate to Next.js.</p><h3>The Core Problem: Why Metadata Fails in SPAs</h3><p>Most React apps are <strong>Single Page Applications (SPAs)</strong>.</p><p>What this means is that HTML is almost empty at first load and Metadata i.e;&lt;meta&gt;, Open Graph, Twitter cards is injected after JavaScript runs <strong>.</strong>The issue with this is that social media crawlers do not execute JavaScript and they only read the initial HTML response.</p><p>In simpler terms,what this means is that the bots expect the metadata of that page/route with the initial HTML response and if there isn’t any it defaults to the metadata in the index.html file. But since SPAs render HTML after JS runs, the bots cannot read the metadata for that page or route as there’s no html to read, soo it defaults to the index.html metadata.</p><p>For example when a bot visits:</p><pre>/products/123</pre><p>It sees:</p><pre>&lt;title&gt;My App&lt;/title&gt;<br> &lt;meta name=&quot;description&quot; content=&quot;Default description&quot; /&gt;</pre><p>The Result is a wrong preview and no product image.</p><h3>Common (But Overkill) Solution: Migrate to Next.js</h3><p>Next.js solves this easily with Server-Side Rendering (SSR) and/or Static Site Generation (SSG).</p><p>But migration means i will have to rewrite my routing logic,rework my data fetching,refactor my deployment pipelines amongst other things and the only problem was metadata, soo this will be overengineering.</p><h3>The Smarter Approach: Add a Minimal Express Server</h3><p>Instead of migrating frameworks, i:</p><ol><li>Kept the React SPA</li><li>Added an Express server</li><li>Dynamically rendered HTML only for bot requests</li></ol><h3>The Architecture</h3><pre>Browser User ──▶ React SPA (normal flow)<br> <br> Social Bot ──▶ Express Server<br> └─▶ Fetch product data<br> └─▶ Return pre-rendered HTML with meta tags</pre><h3>The Implementation</h3><h3>1. Create an Express Server</h3><p>I introduced a simple Express server that sits in front of the React build.</p><pre>const express = require(&quot;express&quot;)<br> const path = require(&quot;path&quot;)<br> <br> const app = express()<br> const PORT = process.env.PORT || 3000</pre><h3><strong>2. Detect Social Media Bots</strong></h3><p>Bots can be identified via the <strong>User-Agent</strong> header.</p><pre>const isBot = (userAgent = &quot;&quot;) =&gt; {<br> return /facebookexternalhit|Twitterbot|WhatsApp|Slackbot|LinkedInBot/i.test(userAgent)<br> }</pre><p>This ensures that only browsers get the SPA and Bots get server-rendered HTML</p><h3>3. Create a Metadata Rendering Route</h3><p>For example:</p><pre><br>app.get(&quot;/products/:id&quot;, async (req, res, next) =&gt; {<br> const userAgent = req.headers[&quot;user-agent&quot;]<br> <br>// if it&#39;s not a bot listening to this route proceed with our middleware<br> if (!isBot(userAgent)) return next()<br> <br> const productId = req.params.id<br> <br> // Fetch product data from API <br> const product = await fetchProduct(productId)<br> <br> return res.send(`<br> &lt;!DOCTYPE html&gt;<br> &lt;html lang=&quot;en&quot;&gt;<br> &lt;head&gt;<br> &lt;title&gt;${product.name}&lt;/title&gt;<br> &lt;meta name=&quot;description&quot; content=&quot;${product.description}&quot; /&gt;<br> <br> &lt;! - Open Graph →<br> &lt;meta property=&quot;og:title&quot; content=&quot;${product.name}&quot; /&gt;<br> &lt;meta property=&quot;og:description&quot; content=&quot;${product.description}&quot; /&gt;<br> &lt;meta property=&quot;og:image&quot; content=&quot;${product.image}&quot; /&gt;<br> &lt;meta property=&quot;og:type&quot; content=&quot;product&quot; /&gt;<br> <br> &lt;! - Twitter →<br> &lt;meta name=&quot;twitter:card&quot; content=&quot;summary_large_image&quot; /&gt;<br> &lt;meta name=&quot;twitter:title&quot; content=&quot;${product.name}&quot; /&gt;<br> &lt;meta name=&quot;twitter:description&quot; content=&quot;${product.description}&quot; /&gt;<br> &lt;meta name=&quot;twitter:image&quot; content=&quot;${product.image}&quot; /&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br> &lt;/body&gt;<br> &lt;/html&gt;<br> `)<br> })<br><br></pre><h3><strong>4. Serve the React App for Everyone Else</strong></h3><p>After bot routes, serve the React build:</p><pre>// get our absolute path<br>const __dirname = path.dirname(__filename)<br>let DIST_PATH = path.join(__dirname, &#39;dist&#39;);<br><br>// SERVE THE REACT BUILD<br>app.use(express.static(DIST_PATH)<br> <br>// ---- SPA FALLBACK( for all other routes serve our index file) ----<br>app.get(/.*/,(req, res) =&gt; {<br>  const indexPath = path.join(DIST_PATH, &#39;index.html&#39;);<br>  return res.sendFile(indexPath) <br>})</pre><h3>Why you do not Need to Migrate to Next.js</h3><ol><li>You only needed metadata rendering,not full SSR.</li><li>Lower risk,no routing rewrites. No broken pages.</li><li>This solution can be implemented in hours, not weeks</li><li>Your app stays as React and is deployable anywhere. PS: if you deployed as a static site you’ll need to convert to a web service.</li></ol><p>Not every problem needs a framework migration.</p><p>By adding a small Express server to handle social media bots, i solved our metadata problem without rewriting our entire React application. The result was accurate link previews, minimal code changes, and full control over how our pages are rendered all while keeping the app fast and client-side for real users.</p><p>Before reaching for Next.js or any heavy SSR solution, it’s worth asking: <em>what problem am I actually trying to solve?</em><br> Sometimes, a focused and well-understood solution is all you need.</p><p>If you found this helpful, consider engaging with the post and following for more practical, real-world engineering insights.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b6a07d14b6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular vs React: A Tale of Frontend Giants .]]></title>
            <link>https://medium.com/@tommywilson972/angular-vs-react-a-tale-of-frontend-giants-62526eca6e5b?source=rss-e01d491da1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/62526eca6e5b</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webdev]]></category>
            <dc:creator><![CDATA[Wilson Oluwatomisin]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 21:43:45 GMT</pubDate>
            <atom:updated>2024-06-27T21:43:45.311Z</atom:updated>
            <content:encoded><![CDATA[<h3>Angular vs React: A Tale of Frontend Giants .</h3><p>Hello, fellow developers and tech enthusiasts! Today, we’re looking at two heavyweights in the frontend world: <strong>Angular</strong> and <strong>React</strong>. Both have their strengths and unique features, and choosing between them often depends on your project requirements and personal preferences. Let’s dive into what makes each of these technologies stand out and how they differ from one another.</p><h3>Angular: The Everything-in-One Framework</h3><h3>What is Angular?</h3><p>Angular, developed and maintained by Google, is a full-fledged frontend framework designed for building dynamic web applications. It offers a comprehensive suite of tools and features out of the box, which makes it a robust choice for large-scale applications.</p><h3>Key Features of Angular</h3><ol><li><strong>Two-Way Data Binding</strong>: Angular’s two-way data binding ensures that changes in the model are reflected in the view and vice versa, keeping the data synchronized.</li><li><strong>Dependency Injection</strong>: Angular has a built-in dependency injection mechanism, which makes it easier to manage and inject services across the application.</li><li><strong>TypeScript</strong>: Angular is built with TypeScript, a superset of JavaScript that adds static typing. This helps in catching errors early in the development process.</li><li><strong>Comprehensive Tooling</strong>: Angular CLI provides powerful tools for scaffolding, building, and deploying applications, enhancing the developer experience.</li></ol><h3>Pros of Angular</h3><ul><li><strong>Comprehensive Framework</strong>: Angular offers a complete solution, including routing, state management, and form validation.</li><li><strong>Strong Community and Support</strong>: Being backed by Google, Angular has a large community and extensive documentation.</li><li><strong>Scalability</strong>: Angular is well-suited for large-scale applications due to its robust architecture and features.</li></ul><h3>Cons of Angular</h3><ul><li><strong>Steep Learning Curve</strong>: Due to its complexity and the use of TypeScript, Angular can be challenging for beginners.</li><li><strong>Verbosity</strong>: Angular code can be verbose, leading to longer development times for simpler tasks.</li></ul><h3>React: The Flexible Library</h3><h3>What is React?</h3><p>React, developed by Facebook, is a JavaScript library focused on building user interfaces, specifically single-page applications. Unlike Angular, React is not a full-fledged framework; it focuses on the view layer and relies on external libraries for additional functionality.</p><h3>Key Features of React</h3><ol><li><strong>Virtual DOM</strong>: React uses a virtual DOM to optimize rendering performance. It updates only the parts of the DOM that have changed, making updates efficient.</li><li><strong>Component-Based Architecture</strong>: React promotes a component-based architecture, allowing developers to build encapsulated components that manage their own state.</li><li><strong>JSX</strong>: React uses JSX, a syntax extension that allows HTML to be written within JavaScript. This makes the code more readable and easier to write.</li><li><strong>Hooks</strong>: React Hooks allow developers to use state and other features in functional components, promoting cleaner and more functional code.</li></ol><h3>Pros of React</h3><ul><li><strong>Flexibility</strong>: React’s unopinionated nature allows developers to choose the libraries and tools they prefer, offering great flexibility.</li><li><strong>Performance</strong>: The virtual DOM contributes to React’s excellent performance.</li><li><strong>Rich Ecosystem</strong>: React’s ecosystem includes a vast set of libraries and tools, such as Redux for state management and React Router for routing.</li></ul><h3>Cons of React</h3><ul><li><strong>Lack of Convention</strong>: React’s flexibility can lead to inconsistent codebases if best practices are not followed.</li><li><strong>Learning Curve for Ecosystem</strong>: While React itself is easy to learn, understanding the broader ecosystem and integrating different tools can be challenging.</li></ul><h3>Choosing Between Angular and React</h3><h3>When to Choose Angular</h3><ul><li><strong>Enterprise-Level Applications</strong>: If you’re building a large-scale application that requires a comprehensive solution with built-in features, Angular is a great choice.</li><li><strong>Strict Typing and Structure</strong>: If you prefer TypeScript and appreciate a well-defined structure, Angular’s opinionated nature will suit you.</li></ul><h3>When to Choose React</h3><ul><li><strong>Flexibility and Customization</strong>: If you need a flexible solution where you can choose your tools and libraries, React offers unmatched flexibility.</li><li><strong>Performance-Critical Applications</strong>: If performance is a key concern, React’s virtual DOM and efficient rendering can provide a significant advantage.</li></ul><h3>My Experience with React in the HNG Internship</h3><p>At <a href="https://hng.tech/internship">HNG</a>, we primarily use React for our frontend development. The flexibility and component-based architecture of React align well with our project needs. React’s vast ecosystem allows us to integrate various tools seamlessly, enhancing our development workflow.</p><p>Participating in the HNG Internship has been an exciting journey. Learning and working with React has expanded my understanding of modern frontend development. The hands-on experience and collaborative environment have been incredibly rewarding, helping me to grow both personally and professionally.</p><p>If you’re curious about the HNG Internship and want to learn more, check out <a href="https://hng.tech/internship">HNG Internship</a> and <a href="https://hng.tech/premium">HNG Premium</a>. These links provide valuable insights into the program and its benefits.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62526eca6e5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Context Api in React]]></title>
            <link>https://medium.com/@tommywilson972/understanding-the-context-api-in-react-b068689eaba7?source=rss-e01d491da1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b068689eaba7</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Wilson Oluwatomisin]]></dc:creator>
            <pubDate>Thu, 22 Jun 2023 22:26:00 GMT</pubDate>
            <atom:updated>2023-06-23T09:54:30.101Z</atom:updated>
            <content:encoded><![CDATA[<p>Good day friends,</p><p>I’ll be discussing a very important concept in React. Soo hang on tight as we delve into the world of the context API!!</p><h3><strong>Definition</strong></h3><p>The context Api in React is a feature that allows us to share data/state with children components without having to pass the state down through the component tree i.e, passing state to those that do not need it consequently leading to what we call ‘Prop Drilling’ which is a process we want to avoid in development.</p><p>Think of the Context API as a way to send state/data to only components that need them. It ensures that only components that need the state get them. I hope that was clear enough okay? Alright!! Let’s continue..</p><p>Below is an example of Prop Drilling</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*y2eRU6EDGsylDOzMj01ZNw.jpeg" /></figure><p>In the example above we see that the data object is passed down through ‘Component2’ just for ‘Component3’ to access it. This process can be long and tedious in cases when the code is long and complexed. Below are some reasons we avoid prop drilling;</p><ul><li>Increased code complexity: Prop drilling can make your code more complex, as you need to pass the data down through the component tree.</li><li>Difficult to test: Prop drilling can make it difficult to test your components, as you need to mock the data that is passed down as props.</li><li>Difficult to maintain: Prop drilling can make it difficult to maintain your code, as you need to update the data that is passed down as props in multiple places.</li></ul><h3><strong>How to use the Context API</strong></h3><p>First thing we do is import the ‘createContext’ method from React like so;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*ym0dbl3xGSf0zPKAJBofuw.jpeg" /></figure><p>Once a context has been created the next step is to create a component that will hold this context as a provider (confusing?? stay with me). Generally a context has a provider and a consumer. The Provider like the name suggests provides the data/state and the Consumer uses it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*3V-rZCI2J7P4uAqFc5zdeg.jpeg" /></figure><p>The parent Component holds the value that the Child component or grand child component will need to access therefore it carries the provider context. We destructure the children prop in the parent component and then wrap this prop with the ParentContext.Provider then we pass the user data into the value prop.</p><p>NB: The children prop is/are the components that need to access the data and we could just go ahead to inject them in like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*uOxEMy75tk-Mdw4izyFFzg.jpeg" /></figure><p>Now the GrandChild component has access to the user data directly as opposed to passing it through it’s own parent component i.e; the child component in the example on prop drilling.</p><p>To use this context in the GrandChild component we would have to import the ‘useContext’ feature from react and embed it directly into the GrandChild component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*Xw7A2AhZTd36WfM5AKFFIQ.jpeg" /></figure><p>The useContext is called within the scope of the GrandChild Component,and it then takes the context in which we want to get the data from as a parameter which in this case is the ‘Parent context’ and we could just go ahead to destructure the name and age value from the context which holds the user object as the value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*SSqbF9bP0g2jT2SmL40sSw.jpeg" /></figure><p>We can see how the Grandchild gets access to user data easily without the need for prop drilling. Context API is a way more efficient method to share data and also helps to save time and resources.</p><p>I hope this Article has been of help to you. If so kindly react to this post ,share and drop a follow, it will be much appreciated.</p><p>Thank you!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b068689eaba7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>