<?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: João Pinho</title>
    <description>The latest articles on DEV Community by João Pinho (@jpinho).</description>
    <link>https://dev.to/jpinho</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%2F210311%2F8e26aa84-a665-48a3-87ee-3e3b91676baa.png</url>
      <title>DEV Community: João Pinho</title>
      <link>https://dev.to/jpinho</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jpinho"/>
    <language>en</language>
    <item>
      <title>Security at Scale: Our npm Incident Response Story</title>
      <dc:creator>João Pinho</dc:creator>
      <pubDate>Wed, 10 Sep 2025 16:20:24 +0000</pubDate>
      <link>https://dev.to/epilot/security-at-scale-our-npm-incident-response-story-439p</link>
      <guid>https://dev.to/epilot/security-at-scale-our-npm-incident-response-story-439p</guid>
      <description>&lt;p&gt;On September 8th, the npm ecosystem saw what is now called the largest supply-chain compromise in its history. Packages like chalk, debug, and ansi-styles — together downloaded billions of times every week — were hijacked and malicious versions published.&lt;/p&gt;

&lt;p&gt;For any SaaS company with Node.js in its stack, this was a moment to pause and act.&lt;/p&gt;

&lt;p&gt;At epilot, where we build cloud software for the energy market, we recognised that this had the potential to impact our systems. Here's how we responded.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚨 First, what happened?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A phishing attack compromised the maintainer of several widely used packages.&lt;/li&gt;
&lt;li&gt;Malicious versions were published and quickly spread via transitive dependencies.&lt;/li&gt;
&lt;li&gt;The injected code was designed to hijack crypto wallet transactions, but the bigger story is: if attackers could publish once, they could publish anything. Additionally, if attackers could read/intercept our network requests, they would have access to our tokens and thus our platform on behalf of our users.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚡ Our response — measured in hours
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;As soon as the incident was announced, our engineering team moved fast. Within minutes of posting the alert in our #dev-security slack channel, we had a small response team come together.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;172 repositories scanned: we used GitHub Codespaces to access our centralized codebase and systematically audit our product ecosystem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;451 Node.js projects analyzed: every package.json across our domain groups (auth, billing, analytics, 360-portal, and more) was checked for the compromised packages and versions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automation helped: we cross-checked with our internal tooling and monitoring alerts to confirm no production build had pulled malicious versions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Result: ✅ zero exposure found across all 451 dependency trees.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛡 Practices that kept us safe
&lt;/h2&gt;

&lt;p&gt;The npm incident highlighted the value of practices we already had in place:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Dependency monitoring with Corge → ongoing visibility into package versions and vulnerabilities across our entire ecosystem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Masked logs in Datadog → all PII automatically obfuscated, ensuring sensitive customer data never leaks, even if dependencies misbehave.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;LLM anonymisation → using Microsoft Presidio, we automatically detect and anonymise emails, phone numbers, IBANs, credit cards, and other PII before any data reaches AI models for our AI-powered features.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These aren't "nice-to-haves." They are part of how we build trust with customers in a regulated industry like energy.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 What we learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Supply chain attacks are inevitable — being able to respond fast is what matters.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modern tooling makes a difference — GitHub Codespaces let us audit 172 repositories and 451 Node.js projects in hours, not days.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Good hygiene compounds — monitoring dependencies, masking logs, and anonymizing LLM data aren't glamorous, but when incidents like this happen, they prove their worth.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🔭 Looking forward
&lt;/h2&gt;

&lt;p&gt;Incidents like the npm compromise will continue. At epilot, we're committed not just to reacting fast, but to building resilient,  privacy-first systems that earn customer trust every day.&lt;/p&gt;

&lt;p&gt;Because in the energy market — where trust and compliance are everything — resilience is the real competitive advantage.&lt;/p&gt;

</description>
      <category>security</category>
      <category>privacy</category>
      <category>npm</category>
    </item>
    <item>
      <title>Exponential Elegance: Rounding Numbers in JS</title>
      <dc:creator>João Pinho</dc:creator>
      <pubDate>Wed, 03 Jan 2024 20:33:39 +0000</pubDate>
      <link>https://dev.to/jpinho/exponential-elegance-rounding-numbers-in-js-1gdo</link>
      <guid>https://dev.to/jpinho/exponential-elegance-rounding-numbers-in-js-1gdo</guid>
      <description>&lt;p&gt;As you may be aware, JavaScript and numbers have unique properties that developers originating from other programming languages should be aware of. You can observe this for yourself: just sum &lt;code&gt;0.1 + 0.2&lt;/code&gt;, and you will see what I mean.&lt;/p&gt;

&lt;p&gt;Another common scenario is when developers explicitly define numbers as &lt;code&gt;const rate = 2.0&lt;/code&gt;. This was common in Java to avoid integer divisions. In JavaScript, you can still definitely use this convention for readability, but it's not required at all given that all numbers are decimals already.&lt;/p&gt;

&lt;p&gt;The point of this post is to introduce another particularity of numbers in JS that may not be well-known, which is the use of the exponential operator.&lt;/p&gt;

&lt;p&gt;Let's say you are tasked with implementing a rounding function in JS. As you know, &lt;code&gt;Math.round&lt;/code&gt; does not provide precision. So a common pattern is, let's say we want a rounding of 2, we could do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Math.round(1000.230499 * 100)&lt;/code&gt; which rounds to &lt;code&gt;100023&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Then you divide it by &lt;code&gt;100&lt;/code&gt; and you get &lt;code&gt;1000.23&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You could easily come up with a generic algorithm that mimics this. But what if I told you that function only takes 5 seconds to write?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Number('1000.230499e2') = 100023.0499&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Number(100023.0499 + 'e-2') = 1000.230499&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So a simple rounding function could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;round&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;decimals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;e&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;decimals&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;`e-&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;decimals&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I thought I would share this as it's quite a powerful way to play around with the "comma" in decimals without having to deal with divisions.&lt;/p&gt;

&lt;p&gt;Even though AI will do this for you these days, it's always good to know the basics. 👊&lt;/p&gt;

&lt;p&gt;[#stayhard] [#keephacking]&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>number</category>
    </item>
    <item>
      <title>Lambda Unleashed: Mastering Massive Data Responses</title>
      <dc:creator>João Pinho</dc:creator>
      <pubDate>Wed, 27 Dec 2023 15:35:52 +0000</pubDate>
      <link>https://dev.to/epilot/lambda-unleashed-mastering-massive-data-responses-3gka</link>
      <guid>https://dev.to/epilot/lambda-unleashed-mastering-massive-data-responses-3gka</guid>
      <description>&lt;p&gt;In the realm of serverless architecture, AWS Lambda has emerged as a cornerstone, offering scalability, flexibility, and efficiency. However, even in this advanced cloud environment, we encounter certain constraints — one being the limit on Lambda response sizes, traditionally capped at 6MB. At first glance, this seems reasonable. After all, APIs are generally not designed to handle or return voluminous amounts of data. The principle of keeping responses lean and efficient underlines much of our best practices in API design.&lt;/p&gt;

&lt;p&gt;But what happens when the unexpected occurs? When, despite our best efforts and designs, the need arises for Lambdas to return larger payloads? It's not always about wanting to push the boundaries; sometimes, it's about adapting to them. In this blog post, I aim to delve into the nuances of scenarios where larger Lambda responses are not just beneficial but necessary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Large Response Middleware
&lt;/h2&gt;

&lt;p&gt;This middleware allows a service to log and save large responses to an S3 bucket, enabling developers to investigate the causes of such large responses. Furthermore, this middleware accepts a special header that allows the rewriting of the response with a &lt;code&gt;$payload_ref&lt;/code&gt; pointing to the large payload stored in S3, enabling clients to recover gracefully.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Case
&lt;/h3&gt;

&lt;p&gt;An internal application of this middleware at epilot involves a service that constructs a Programmatic Runtime containing a large &lt;code&gt;{} variable&lt;/code&gt; context. This context is then used to generate sophisticated Document Templates.  Our clients leverage these templates to dispatch Emails or Attachments to their end-customers. Although the resulting context may be substantial, its necessity is unquestionable for thorough exploration and real-time evaluation of the compiled template against the context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Limitations
&lt;/h3&gt;

&lt;p&gt;This work is a great all-in-one solution for one specific lambda use case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API Gateway with Lambda Proxy Integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although, while we at @epilot use this pattern a lot, it's by no means the only way Lambda is used.&lt;/p&gt;

&lt;p&gt;The same 6MB response limit applies in all Lambda use cases. Just to give some examples that are not covered by this middleware:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lambda function URLs&lt;/li&gt;
&lt;li&gt;Lambda in Step Functions&lt;/li&gt;
&lt;li&gt;Direct Invoke via Lambda API&lt;/li&gt;
&lt;li&gt;API Gateway Lambda service integration&lt;/li&gt;
&lt;li&gt;Lambda@Edge&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since the 6MB limit applies anywhere, we could build and publish something more generic that works for all Lambda use cases (not just this one).&lt;/p&gt;

&lt;p&gt;The good news for the community is that, we've an open issue for that &lt;a href="https://github.com/epilot-dev/aws-lambda-utility-middlewares/issues/1" rel="noopener noreferrer"&gt;aws-lambda-utility-middlewares/issues/1&lt;/a&gt;. And we may put some more work on it during the near future. Contributions are also more than welcomed 🙌&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fmv9q7b4eg1hq106suqr5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fmv9q7b4eg1hq106suqr5.png" alt="Sequence Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For handling a Large Response, clients must request with the HTTP Header &lt;code&gt;Accept: application/large-response.vnd+json&lt;/code&gt;. This custom MIME type signals consent to receive a large response payload when required. The format of the response body for this MIME type is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$payload_ref"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://&amp;lt;s3 file reference link&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Should the client specify this MIME type, the Lambda bypasses logging an error with &lt;code&gt;Log.error&lt;/code&gt;. Instead, it restructures the original response, incorporating a reference to the substantial payload now in S3. The modified response also carries the HTTP header &lt;code&gt;Content-Type&lt;/code&gt; set to &lt;code&gt;application/large-response.vnd+json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Absent this MIME type, the Lambda logs an error using &lt;code&gt;Log.error&lt;/code&gt;, leading to a response failure due to the oversized body.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuration Options
&lt;/h3&gt;

&lt;p&gt;Supported Parameters:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;thresholdWarn&lt;/td&gt;
&lt;td&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Warning threshold level (percentage of &lt;code&gt;sizeLimitInMB&lt;/code&gt;), e.g: 0.80&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;thresholdError&lt;/td&gt;
&lt;td&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Error threshold level (percentage of &lt;code&gt;sizeLimitInMB&lt;/code&gt;), e.g: 0.90&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sizeLimitInMB&lt;/td&gt;
&lt;td&gt;&lt;code&gt;number&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Maximum allowed size limit in MB, e.g 6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;outputBucket&lt;/td&gt;
&lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Identifier or name of the output S3 bucket&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;groupRequestsBy&lt;/td&gt;
&lt;td&gt;&lt;code&gt;function - mapper&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Function to group requests, based on API Gateway event V2. Defaults to 'all'&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Example Usage:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;p&gt;&lt;span class="nf"&gt;withLargeResponseHandler&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;br&gt;
  &lt;span class="na"&gt;thresholdWarn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.85&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// 85% of the limit = 5.1MB&lt;/span&gt;&lt;br&gt;
  &lt;span class="na"&gt;thresholdError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// 90% of the limit = 5.4MB&lt;/span&gt;&lt;br&gt;
  &lt;span class="na"&gt;sizeLimitInMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;br&gt;
&lt;span class="p"&gt;}),&lt;/span&gt;&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Repository&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;Explore the repository and npm package here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/epilot-dev/aws-lambda-utility-middlewares" rel="noopener noreferrer"&gt;github.com/epilot-dev/aws-lambda-utility-middlewares&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/@epilot/large-response-middleware" rel="noopener noreferrer"&gt;npmjs.com/package/@epilot/large-response-middleware&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for reading! If you found this post insightful, please don't hesitate to show your reaction and support.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/epilot"&gt;#stay-hard #keep-pushing-the-limits&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wishing you a Happy New Year's Eve! May the year ahead be filled with innovation and success.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>middleware</category>
      <category>serverless</category>
      <category>node</category>
    </item>
    <item>
      <title>Using React within Your Svelte Applications</title>
      <dc:creator>João Pinho</dc:creator>
      <pubDate>Mon, 19 Jul 2021 09:22:48 +0000</pubDate>
      <link>https://dev.to/jpinho/using-react-within-your-svelte-applications-21kb</link>
      <guid>https://dev.to/jpinho/using-react-within-your-svelte-applications-21kb</guid>
      <description>&lt;h2&gt;
  
  
  What is this post about?
&lt;/h2&gt;

&lt;p&gt;This blog post is about, how can you inject your React components within your Svelte Application. A couple of reasons for this, but not limited to, are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have a big codebase in React and you want to try a new piece of your Architecture in Svelte without jeopardizing all that you have built over the years&lt;/li&gt;
&lt;li&gt;You want to support a hybrid model so that your ReactJS Developers have time to keep up with Svelte until they finally move over&lt;/li&gt;
&lt;li&gt;You really need to integrate with this amazing ReactJS library and they do not have a Svelte version of it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And as a final note, let me just answer the question that is on the back of your head:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can do everything that you do in React in Svelte and more!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How can you build Svelte and React Side-by-side?
&lt;/h2&gt;

&lt;p&gt;You will need at least 2 things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to install react and react-dom
React lives on the browser and Svelte compiles on the server, therefore you will need to render your React within Svelte onMount handlers&lt;/li&gt;
&lt;li&gt;To help you with this, I’ve built a nice abstraction and this is how it looks:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@material-ui/core/Button&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactAdapter&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./utils/ReactAdapter.svelte&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ReactAdapter&lt;/span&gt;
  &lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mui-btn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;variant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;contained&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello world!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="cm"&gt;/**
   * Styling a React Component from within a Svelte Component.
   */&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;global&lt;/span&gt;&lt;span class="p"&gt;(.&lt;/span&gt;&lt;span class="nx"&gt;mui&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;btn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/style&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see above I’m using the ReactAdapter. That adapter is an abstraction that basically, given a React component, expands all its props into the final rendered React component without you having to care how to inject the React component itself in Svelte.&lt;/p&gt;

&lt;p&gt;For the full article, including a deep dive into the implementation of ReactAdapter &lt;a href="https://jpepinho.medium.com/using-react-within-your-svelte-applications-3b1f2a75aefc"&gt;check this Medium article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The repo with docs and the code is here at &lt;a href="https://github.com/jpinho/svelte-react"&gt;jpinho/svelte-react&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
