<?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>Forem: Danilo Woznica</title>
    <description>The latest articles on Forem by Danilo Woznica (@danilowoz).</description>
    <link>https://forem.com/danilowoz</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%2F33056%2Fea9af577-99e9-4c5b-987b-477f0daaf45a.jpg</url>
      <title>Forem: Danilo Woznica</title>
      <link>https://forem.com/danilowoz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/danilowoz"/>
    <language>en</language>
    <item>
      <title>Using Sandpack for React Libraries Documentation</title>
      <dc:creator>Danilo Woznica</dc:creator>
      <pubDate>Wed, 19 Apr 2023 16:00:12 +0000</pubDate>
      <link>https://forem.com/codesandboxio/using-sandpack-for-react-libraries-documentation-4838</link>
      <guid>https://forem.com/codesandboxio/using-sandpack-for-react-libraries-documentation-4838</guid>
      <description>&lt;p&gt;&lt;strong&gt;Sandpack is an open-source component toolkit that allows for interactive, live-running code editing experiences in the browser.&lt;/strong&gt; &lt;strong&gt;This in-browser bundler is the engine behind CodeSandbox.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Recently, &lt;a href="https://codesandbox.io/blog/announcing-sandpack-2"&gt;Sandpack expanded its capabilities&lt;/a&gt; by adding support for Node.js templates. With this new feature, users can run Next.js 13, Vite 3, and other frameworks directly in the browser on Chrome, Firefox, and Safari.&lt;/p&gt;

&lt;p&gt;With Sandpack's live coding experience, users can get a full live-coding journey from a live sandbox to a close-to-localhost experience:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sandpack editor: a themeable and responsive full editor experience with syntax highlighting, touch-device support, file explorer, and debug tools.&lt;/li&gt;
&lt;li&gt;Real-time edit: an advanced preview that uses NPM dependency support, hot module reloading, caching, etc.&lt;/li&gt;
&lt;li&gt;Full development experience: open sandboxes directly in CodeSandbox with one click, which provides a full in-cloud development experience.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  By developers, for developers
&lt;/h3&gt;

&lt;p&gt;At CodeSandbox, one of our core values is accessibility: making sure that nothing prevents developers from making their ideas come to life. This is what Sandpack is all about. It greatly reduces the entry barriers for beginner developers who are just getting started with a new library or are unfamiliar with the tools required for local development.&lt;/p&gt;

&lt;p&gt;By using Sandpack to run coding examples in your Docs, you allow your end-users to interact with live code directly from the Docs and see the results in real-time without having to leave the page. &lt;/p&gt;

&lt;p&gt;Additionally, by providing interactive tutorials and a safe environment to experiment, Sandpack can help developers gain more confidence and build skills more quickly and effectively.&lt;/p&gt;

&lt;p&gt;Getting excited? Let's get started with it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing
&lt;/h3&gt;

&lt;p&gt;Install the Sandpack dependency on your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i @codesandbox/sandpack-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All the components and the bundler are packed inside the Sandpack component, which is a named export of the package. Besides that, the package contains multiple &lt;strong&gt;components&lt;/strong&gt;, &lt;strong&gt;utilities&lt;/strong&gt;, and &lt;strong&gt;typings&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Sandpack&lt;/span&gt; &lt;span class="p"&gt;}&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;@codesandbox/sandpack-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Sandpack&lt;/span&gt; &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"node"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;That's it! Now you have an editor and preview component running a basic Node.js server inside of your browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who's using Sandpack?
&lt;/h2&gt;

&lt;p&gt;We've been working closely with the React community to solve real problems. From educational websites to open-source project documentation, we spend a lot on research, design, and testing to remove the friction of coding in a browser and empower content creators.&lt;/p&gt;

&lt;p&gt;That's why we believe Sandpack is quickly becoming a go-to tool for anyone looking to provide their users with a seamless, accessible and powerful web development experience.&lt;/p&gt;

&lt;p&gt;Let's explore a few projects using Sandpack in different ways.&lt;/p&gt;

&lt;h3&gt;
  
  
  React documentation: the extra mile implementation
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://react.dev"&gt;React documentation&lt;/a&gt; implemented a very custom version of Sandpack, which basically relies on the &lt;code&gt;SandpackProvider&lt;/code&gt; component to handle the file states, &lt;code&gt;SandpackCodeEditor&lt;/code&gt; to edit the code, and &lt;code&gt;SandpackPreview&lt;/code&gt; to render the code output.&lt;/p&gt;

&lt;p&gt;Everything else—such as the theme, component composition and styles—is built internally, which makes it the most advanced implementation example in the Sandpack ecosystem, and gives an example of how extensible Sandpack can be.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://react.dev"&gt;react.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VDFtJmm6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zmyl45ptgr4cjoh4rad1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VDFtJmm6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zmyl45ptgr4cjoh4rad1.jpg" alt="React docs" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Chakra UI: the nicest library playground
&lt;/h3&gt;

&lt;p&gt;With Sandpack components, you can basically build your own CodeSandbox.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://play.chakra-ui.com/playground"&gt;Chakra UI&lt;/a&gt; understood this, and they implemented other capabilities on top of Sandpack, such as code formatting and shareable URLs. Besides that, you can simply use different code editors, like Monaco, which can provide autocompletion by default.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://play.chakra-ui.com/playground"&gt;play.chakra-ui.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LR_XjZNu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0mhee1g1wuxldi2ndcos.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LR_XjZNu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0mhee1g1wuxldi2ndcos.jpg" alt="Chakra UI" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  React Spring: documentation can be fun
&lt;/h3&gt;

&lt;p&gt;Sandpack can be the best friend of visual React projects, such as animation APIs and UI libraries.&lt;/p&gt;

&lt;p&gt;You can turn static snippets of codes on live examples, reducing the barriers to visualizing the library output, or simply trying out different parameters. This is precisely what &lt;a href="https://www.react-spring.dev/docs/getting-started"&gt;React Spring&lt;/a&gt; did on their Docs.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://www.react-spring.dev/docs/getting-started"&gt;www.react-spring.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--19xnJ_r2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nbdqrfmk3fvosrthb50f.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--19xnJ_r2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nbdqrfmk3fvosrthb50f.jpg" alt="React spring" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Jest-extended: going beyond the preview component
&lt;/h3&gt;

&lt;p&gt;So far, we have only talked about the default layout (Editor + Preview).&lt;/p&gt;

&lt;p&gt;However, Sandpack fits many additional use cases, such as showing the output of unit tests and console logs. That's possible because Sandpack can execute a range of environments, including Jest, as seen on the &lt;a href="https://jest-extended.jestcommunity.dev/"&gt;jest-extended Docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://jest-extended.jestcommunity.dev/"&gt;jest-extended.jestcommunity.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--68b9idMC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34sasjrhzrywkh4duhjt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--68b9idMC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34sasjrhzrywkh4duhjt.jpg" alt="Jest" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explore all the features
&lt;/h2&gt;

&lt;p&gt;The examples we shared above are great to see what Sandpack is capable of—but there’s a lot more to unpack!&lt;/p&gt;

&lt;p&gt;See below a brief overview of some of the awesome things Sandpack enables you to do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Templates
&lt;/h3&gt;

&lt;p&gt;Currently, Sandpack supports several templates, from client to server templates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Static&lt;/li&gt;
&lt;li&gt;Angular&lt;/li&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;li&gt;React TS&lt;/li&gt;
&lt;li&gt;Node&lt;/li&gt;
&lt;li&gt;Nextjs&lt;/li&gt;
&lt;li&gt;Vite&lt;/li&gt;
&lt;li&gt;Astro&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And &lt;a href="https://sandpack.codesandbox.io/docs/quickstart"&gt;many more&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Extensible components
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;File-explorer: a minimal but very powerful experience to navigate through files. You can open and close folders, and open new files;&lt;/li&gt;
&lt;li&gt;Tests: renders a thin wrapper around &lt;a href="https://jestjs.io/"&gt;Jest&lt;/a&gt; to run tests directly in the browser;&lt;/li&gt;
&lt;li&gt;Console: devtool that allows printing the console logs from a Sandpack client;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More details and examples on &lt;a href="https://sandpack.codesandbox.io/docs/advanced-usage/components"&gt;Sandpack documentation.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Local packages
&lt;/h3&gt;

&lt;p&gt;Although Sandpack mostly relies on NPM to fetch dependencies, you can also provide local package/dependencies by injecting them into the Sandpack context and test on development libraries.&lt;/p&gt;

&lt;p&gt;More information on &lt;a href="https://sandpack.codesandbox.io/docs/guides/local-dependencies"&gt;how to consume local dependencies/package on Sandpack&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Themes
&lt;/h3&gt;

&lt;p&gt;The overall style can be set through the theme prop, but Sandpack also offers a set of predefined options through &lt;code&gt;@codesandbox/sandpack-themes&lt;/code&gt;, an open-source package that contains many other &lt;a href="https://sandpack.codesandbox.io/docs/getting-started/themes"&gt;themes compatible with Sandpack&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make your project more accessible
&lt;/h2&gt;

&lt;p&gt;Seeing all the love and support that Sandpack gets from the community keeps pushing us forward to make it even better and more powerful.&lt;/p&gt;

&lt;p&gt;If you have any suggestions on how we can improve Sandpack, feel free to &lt;a href="https://github.com/codesandbox/sandpack/issues"&gt;open an issue on GitHub&lt;/a&gt;. And if you have added Sandpack to our docs, we’d love to see the result—tweet it &lt;a href="https://twitter.com/codesandbox"&gt;@CodeSandbox&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codesandbox</category>
      <category>react</category>
      <category>documentation</category>
    </item>
    <item>
      <title>Sandpack v1: a fresh design and a new accessible API</title>
      <dc:creator>Danilo Woznica</dc:creator>
      <pubDate>Thu, 16 Jun 2022 17:10:11 +0000</pubDate>
      <link>https://forem.com/codesandboxio/sandpack-v1-a-fresh-design-and-a-new-accessible-api-2am5</link>
      <guid>https://forem.com/codesandboxio/sandpack-v1-a-fresh-design-and-a-new-accessible-api-2am5</guid>
      <description>&lt;p&gt;Since we &lt;a href="https://codesandbox.io/post/sandpack-announcement"&gt;announced Sandpack&lt;/a&gt;, we didn't stop a minute. We've been working hard alongside the community to improve it and make it even better. And to be honest, we're amazed how the community embraced Sandpack. As a result, many projects can now empower their users and provide a better code experience in their own project and website.&lt;/p&gt;

&lt;p&gt;But today, we'd like to introduce a new step in the Sandpack journey. We listened to you, and we're very excited to introduce a major release of Sandpack, which takes into account many feature requests, a complete redesign, and a ton of improvements in the API.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What is Sandpack?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Sandpack is a component toolkit that makes it possible to have interactive, live-running code editing experiences in the browser. It is the in-browser bundler that powers CodeSandbox that is now open source.&lt;/p&gt;

&lt;p&gt;With Sandpack's live coding environment, you get:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A full editor experience with syntax highlighting.&lt;/li&gt;
&lt;li&gt;An advanced preview that takes advantage of npm dependency support, hot module reloading, etc.&lt;/li&gt;
&lt;li&gt;One click away from opening your code snippets directly in CodeSandbox.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  One step back
&lt;/h3&gt;

&lt;p&gt;The very first version of Sandpack was released in 2018. Since then, we haven't had the chance to take a step back and rethink how you interact with it and how the Sandpack components fit in your website. Plus, we realized that we need to be prepared for the future challenge that might come. That's why we recreated the surface API and the design of the components to open more opportunities for us, and you!&lt;/p&gt;

&lt;p&gt;So, at the first look, all the breaking changes introduced in this major version might not look significant. But, they're crucial to keep us evolving the product and still keep it extensible, customizable, and easy to use.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's new?
&lt;/h3&gt;

&lt;h4&gt;
  
  
  A new design, from scratch
&lt;/h4&gt;

&lt;p&gt;We challenge ourselves to come up with a solution that could fit in different layouts and contexts, but still be accessible and customizable. As a result, we created a new set of themes, icons, design tokens, and components from scratch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_jg6eENn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uz2eor307f3rszhzkrw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_jg6eENn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uz2eor307f3rszhzkrw.gif" alt="new design" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Bring your favorite theme to Sandpack
&lt;/h4&gt;

&lt;p&gt;All themes are available now on &lt;code&gt;@codesandbox/sandpack-themes&lt;/code&gt;, so which means that you’re able now to contribute to Sandpack and create your favorite theme.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://sandpack.codesandbox.io/theme"&gt;https://sandpack.codesandbox.io/theme&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IHMcOPj6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qacop2r3o0w1ew2ppu6h.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IHMcOPj6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qacop2r3o0w1ew2ppu6h.gif" alt="themes" width="768" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Sandpack file explorer
&lt;/h4&gt;

&lt;p&gt;We listened to you, and now Sandpack has a new component to navigate, open and close files, empowering your sandboxes and examples. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_jg6eENn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uz2eor307f3rszhzkrw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_jg6eENn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uz2eor307f3rszhzkrw.gif" alt="file explorer" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And much more:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSR: syntax-highlight on the server, dedupe styles, and a more lightweight output;&lt;/li&gt;
&lt;li&gt;New API: it fixes many inconsistencies, and improves the discoverability of some options;&lt;/li&gt;
&lt;li&gt;Improve error message descriptions;&lt;/li&gt;
&lt;li&gt;Support React 18;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out the Migration guide and get more info: &lt;a href="https://sandpack.codesandbox.io/docs/releases/v1"&gt;https://sandpack.codesandbox.io/docs/releases/v1&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What's next?
&lt;/h3&gt;

&lt;p&gt;Your opinion is very important to us. As we already said, most of these improvements came from community requests and bug reports. So, if you have any feature requests or want to understand how Sandpack might fit in your project, don't hesitate to reach out on our Discord channel or GitHub repository.&lt;/p&gt;

</description>
      <category>web</category>
      <category>development</category>
      <category>tooling</category>
    </item>
    <item>
      <title>A React code editor</title>
      <dc:creator>Danilo Woznica</dc:creator>
      <pubDate>Wed, 19 May 2021 18:34:37 +0000</pubDate>
      <link>https://forem.com/danilowoz/a-react-code-editor-3b3m</link>
      <guid>https://forem.com/danilowoz/a-react-code-editor-3b3m</guid>
      <description>&lt;p&gt;Have we already exhausted the possibilities of how we interact with our favorite code editor? Have we got so used to how we code to achieve a certain goal we can no longer see any way to involve it?&lt;/p&gt;

&lt;p&gt;Since I started to work at &lt;a href="https://codesandbox.io/?from-app=1" rel="noopener noreferrer"&gt;CodeSandbox&lt;/a&gt;, I've seen myself facing those issues more often. Besides that, I began to wonder how beginners are struggling to rule the code editor and learn their favorite framework simultaneously.&lt;/p&gt;

&lt;p&gt;Therefore, I challenged myself to come up with a code editor/IDE for beginner developers focused on ReactJS and what this concept might look like.&lt;/p&gt;

&lt;h2&gt;
  
  
  The anatomy of a component
&lt;/h2&gt;

&lt;p&gt;The first concept came to me some time ago, when I was teaching a friend of mine more about React and how a component works. I remember I said the component itself has a proper "anatomy". Later, I realized it makes a lot of sense because &lt;strong&gt;we know where things are supposed to be in a component.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In other words:&lt;/p&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%2Fm3q2mp49wv7k2l2gor5n.jpg" 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%2Fm3q2mp49wv7k2l2gor5n.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So basically, we can predict what actions the user might take and teach them the best practices. So, this idea evolved to a new concept which are menus with context-sensitive intentions linked to those sectors.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://player.vimeo.com/video/552534032" width="710" height="399"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The whole point of this concept is that we can understand the code to provide a way to make a new code editor with whatever framework or even language we want. I just used React to illustrate the idea.&lt;/p&gt;

</description>
      <category>react</category>
      <category>design</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Four lessons I learned from maintaining a 10k stars project on Github</title>
      <dc:creator>Danilo Woznica</dc:creator>
      <pubDate>Mon, 30 Nov 2020 13:35:20 +0000</pubDate>
      <link>https://forem.com/danilowoz/four-lessons-i-learned-from-maintaining-a-10k-stars-project-on-github-3768</link>
      <guid>https://forem.com/danilowoz/four-lessons-i-learned-from-maintaining-a-10k-stars-project-on-github-3768</guid>
      <description>&lt;p&gt;In 2017 I started a new project with a single goal: learn unit testing. Since then a lot of things have happened with  &lt;a href="https://github.com/danilowoz/react-content-loader"&gt;react-content-loader&lt;/a&gt; (a React skeleton package) and it reached a status that I could never have imagined. It has had countless contributions, suggestions and discussions, and I’ve had the opportunity to interact with many awesome developers around the world.&lt;/p&gt;

&lt;p&gt;Also, the open-source community - especially the React one - has taught me a couple of lessons that I'd like to share with present or future project maintainers.&lt;/p&gt;

&lt;h3&gt;
  
  
  The open-source potential
&lt;/h3&gt;

&lt;p&gt;As the source code is available to any person in the world to check out, different perspectives and opinions come up, and that's amazing. I have no idea how many times the codebase itself and the build script were rewritten from scratch in order to improve legibility, performance and/or compatibility. Also, contributions are not only about coding, but issues with documentation, bug reporting, doubts, and examples.These issues are also very important to build a successful project.&lt;/p&gt;

&lt;p&gt;In one of these issues, I realized that sometimes a product needs support to make it more usable. So, I figured out a way to create another new tool which would help the main project; as a result, I came up with &lt;a href="https://skeletonreact.com"&gt;create-content-loader&lt;/a&gt; to introduce presets, add examples from the community, include documentation and third-party tutorials. From that moment on, the main project improved significantly and became much easier to use. Consequently, more developers can use the project and also contribute to it, creating a sub-community around it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Focus on one problem and solve it
&lt;/h3&gt;

&lt;p&gt;While the product is growing, it's easy to lose sight of the original goal, which makes us add more and more features in the main project. Edge cases, bugs, alternatives, among others, might come up during the development process, so it's essential to keep the scope defined (but not closed) to keep the purpose of the project clear.&lt;/p&gt;

&lt;p&gt;Also, you should try to design APIs as generically as you can. You should try to solve the biggest part of the problem, not all specific cases - that's why it's also important to say no. Sometimes, a small problem may be solved with a workaround instead of being solved by publishing more extra code for everybody else.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep yourself up-to-date
&lt;/h3&gt;

&lt;p&gt;Once I solved the main problem in my project, I was able to try so many things such as different builders, testing libraries, framework support and automatization of a few processes. Indeed, my open-source projects are my lab, where I'm able to implement, test and publish improvements which can be tested by many users and websites. Even when some of these changes introduce new bugs or break the whole project, I know that it's part of the learning process, and the community is there helping with solutions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Be welcoming, be kind, be responsible
&lt;/h3&gt;

&lt;p&gt;Regardless if you're a maintainer or a regular contributor of open-source projects, you've probably faced some situations where you don't know how "open" that project really is. There are a lot of concerns, such as pull requests that are still waiting to be merged, missing documentation or contributing guide, or even a maintainer who doesn't accept any suggestion.&lt;/p&gt;

&lt;p&gt;A truly open-source project has its guides, and it welcomes suggestions and changes. Personally, I feel like such behavior and approach in leading a project have made me much better as a developer, thanks to many discussions and change requests. As a consequence, at some point, I realized that the project no longer belonged to me, but to the entire community as well.&lt;/p&gt;

&lt;p&gt;Also, you need to be responsible. Every proposal, every push to the main branch and every new contributor added need to be done with certainty that no malicious script or bug is being introduced in the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rewarding part
&lt;/h2&gt;

&lt;p&gt;The benefits of having such a project on a Github profile are undeniable. Besides, a successful open-source project is the opportunity to show your hard and soft skills, since managing a project is not only pushing code to branches, but also organizing, prioritizing, describing, and planning features and bugs.&lt;/p&gt;

&lt;p&gt;Success isn't measured in Github stars but rather in complete user satisfaction. To be honest, I still don't know if I've reached that, but I have no doubt that I’ve learned many lessons so far.&lt;/p&gt;

&lt;p&gt;Read more on &lt;a href="https://danilowoz.com"&gt;danilowoz.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>github</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Beginner Guide: where to start testing in JavaScript</title>
      <dc:creator>Danilo Woznica</dc:creator>
      <pubDate>Sun, 01 Nov 2020 16:58:32 +0000</pubDate>
      <link>https://forem.com/danilowoz/beginner-guide-where-to-start-testing-in-javascript-4886</link>
      <guid>https://forem.com/danilowoz/beginner-guide-where-to-start-testing-in-javascript-4886</guid>
      <description>&lt;p&gt;&lt;a href="https://dribbble.com/Fredjesus1"&gt;&lt;sup&gt;&lt;em&gt;Cover image by Fred Jesus&lt;/em&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most common questions I've been asked by my colleagues recently - when they start writing unit tests - is: well, what should I test? Regardless of the language, one of the main challenges is knowing what to check and how to be sure that it covers all possible bugs - which is almost an impossible task. In the following, I would like to introduce you to one possible way to write tests, making you feel more confident and productive while writing unit tests in Javascript.&lt;/p&gt;

&lt;p&gt;It's worth mentioning that the goal here is not to discuss how much unit testing will make your application bug-free nor what kind of technology/library you should use; this conversation is for another time. However, I'm assuming you do want to write unit tests in JavaScript, and you're looking for a guide for writing useful tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  The nature of the unit test
&lt;/h3&gt;

&lt;p&gt;First of all, you'll need to set up your stack to support unit tests. From vanilla Javascript to React, many excellent tools can provide APIs to make it easier, so I'm going to leave some useful links that will help you in this step, like &lt;a href="https://jestjs.io/docs/en/getting-started"&gt;Jest&lt;/a&gt; and &lt;a href="https://testing-library.com/docs/react-testing-library/intro"&gt;React testing library&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Afterwards, there is some consensus in the community on how the unit test should look and its anatomy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Atomic:&lt;/strong&gt; each assertion must have a clear purpose and test only one (with expectations) result or piece of the function;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Independent:&lt;/strong&gt; it needs to be dependency-free, or in cases where that's not possible, it must be mocked. The dependency here means everything in this particular assertion needs to work correctly, like a submit form that dispatches a request. In this case, the request doesn't belong to the submit test;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pure:&lt;/strong&gt; the assertion must not have any side-effects that are not handled by the return of the function; for instance: given specific parameters, the returned values should be predictable;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Business logic-only:&lt;/strong&gt; write assertions that ensure the methods, rules, and the primary purpose of the function is working as expected, and does not causes side-effects, reactions in other modules, or even UI changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The three steps
&lt;/h3&gt;

&lt;p&gt;The best way I've found to describe this idea shortly is to split it into three steps, which will guide you when writing unit tests:&lt;/p&gt;

&lt;h4&gt;
  
  
  Purpose
&lt;/h4&gt;

&lt;p&gt;It might sound obvious, but the most important thing about writing unit tests is to ensure that the implementation is working as expected, along with preventing regressions as development continues. In other words, the test will let you know if some future change breaks the functionality of your tested functions.&lt;/p&gt;

&lt;p&gt;So to achieve this goal, ask yourself what the purpose of the function is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is this supposed to do? And what is not supposed to do?&lt;/li&gt;
&lt;li&gt;Given “these“ arguments, what is the return?&lt;/li&gt;
&lt;li&gt;Are the values returned predictable enough?&lt;/li&gt;
&lt;li&gt;On a date implementation: performing the test in a different timezone, what is the result? Does it still work?&lt;/li&gt;
&lt;li&gt;On the React component: what does it render? Are the events are fired?&lt;/li&gt;
&lt;li&gt;Also, in React components: does it support internationalization, click events, state updates, or any kind of dynamic variation that would be worth being tested?
&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="nx"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pxToRem - Purpose&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should receive a number and return the value in rem&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pxToRem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1rem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should round the number to keep only one decimals&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pxToRem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1.3rem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should try to convert a string in a number&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pxToRem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;16&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1rem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should convert a number to rem with the body font-size argument&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bodyFontSize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pxToRem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;bodyFontSize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0.8em&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&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;Here will be where you could spend more time writing assertions since it needs to cover all internal conditionals, branches, and variations of your implementations. It will make you more confident that your application works.&lt;/p&gt;

&lt;h3&gt;
  
  
  Avoiding errors
&lt;/h3&gt;

&lt;p&gt;Once you are sure that everything is working correctly, and returning the expected results, the next goal is to try to break your function as hard as possible. Focus on covering all unhandled errors, and create real-world scenarios.&lt;/p&gt;

&lt;p&gt;For instance, sometimes you don't have control over arguments and contexts, so it’s good to know how your implementation will behave:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pass wrong arguments (like undefined, null, or an invalid date) or do not pass some of them (even those that are required);&lt;/li&gt;
&lt;li&gt;Execute in different contexts, or perform the function more times than expected;&lt;/li&gt;
&lt;li&gt;Regardless of type-checking (like Typescript or Flow), try to mix up all arguments (in some cases, we don’t control the data flow);&lt;/li&gt;
&lt;li&gt;Test as close to the real scenario as possible; any way to throw an error here is valid.
&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="nx"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pxToRem - Avoiding error&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should return 1rem if the argument is null&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pxToRem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1rem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should return 1rem if the argument is not a number&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pxToRem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;NaN&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1rem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should work correctly with the 2nd argument is invalid&lt;/span&gt;&lt;span class="dl"&gt;'&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pxToRem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1rem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&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;Of course, after finding all those errors and places that weren't covered, it’s time to fix it!&lt;/p&gt;

&lt;h3&gt;
  
  
  Improvements - maintenance
&lt;/h3&gt;

&lt;p&gt;Sometimes writing unit tests might lead to other tasks. Indeed you’ll be able to realize while you’re writing tests that your implementation could be improved or even split in smaller pieces, but keep in mind these changes and improvements enhance the maintenance and that all parts of code are touched by assertions. Think about these issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Isn’t there any way to make it simple to maintain?&lt;/li&gt;
&lt;li&gt;Could it be split into smaller pieces?&lt;/li&gt;
&lt;li&gt;Is every part of the code tested?&lt;/li&gt;
&lt;li&gt;Is there a way to turn it faster?&lt;/li&gt;
&lt;li&gt;I once read that if it is worth testing, it is worth documenting too. I’d strongly suggest trying to describe how and mostly why you’ve built it like that. Would your future self understand this implementation?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Next steps
&lt;/h2&gt;

&lt;p&gt;I like to think of unit testing not only as writing assertions with your favorite framework but rather as a whole pack. You need to have the right mindset and be willing to refactor many files in order to achieve your goal. On the other hand, you need a starting point, and I guess this provides you a good direction, to then go further with more complex tests and find out your favorite way to write assertions.&lt;/p&gt;

&lt;p&gt;Once you’re comfortable with all the content introduced here, I’d recommend looking at some methodologies like &lt;a href="https://technologyconversations.com/2013/12/20/test-driven-development-tdd-example-walkthrough"&gt;TDD&lt;/a&gt; and &lt;a href="https://medium.com/javascript-scene/behavior-driven-development-bdd-and-functional-testing-62084ad7f1f2"&gt;BDD&lt;/a&gt;; plus some different approaches to testing applications like &lt;a href="https://www.softwaretestinghelp.com/what-is-end-to-end-testing/"&gt;end-to-end&lt;/a&gt; and &lt;a href="https://www.guru99.com/integration-testing.html"&gt;integration tests&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://danilowoz.com/"&gt;danilowoz.com&lt;/a&gt;&lt;/p&gt;




</description>
      <category>javascript</category>
      <category>testing</category>
    </item>
    <item>
      <title>Generating TypeScript types and React Hooks based on a GraphQL endpoint</title>
      <dc:creator>Danilo Woznica</dc:creator>
      <pubDate>Mon, 07 Sep 2020 12:42:26 +0000</pubDate>
      <link>https://forem.com/danilowoz/how-to-use-react-hooks-on-code-generator-graphql-2hee</link>
      <guid>https://forem.com/danilowoz/how-to-use-react-hooks-on-code-generator-graphql-2hee</guid>
      <description>&lt;p&gt;&lt;a href="https://dribbble.com/Fredjesus1"&gt;&lt;sup&gt;&lt;em&gt;Cover image by Fred Jesus&lt;/em&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nowadays, developing ReactJS with TypeScript gives us a solid way to write applications: it adds the advantage of type-safety, component auto-documentation, error handling, and accurate autocomplete in the editor code. However, it still requires a considerable effort to write types and keep them maintainable. Moreover, when the data provider is a GraphQL server, it makes you feel like you're doing a useless job, given the server already has its own schemas for types. Seem redundant, right?&lt;/p&gt;

&lt;p&gt;With this in mind, &lt;a href="https://graphql-code-generator.com/"&gt;GraphQL Code Generator&lt;/a&gt; gives us the ability to generate TypesScript typing out of GraphQL schemas. Beyond that, it gives us a couple of plugins to create custom React hooks that don't require any kind of maintenance or workaround to fit into your application.&lt;/p&gt;

&lt;p&gt;Among many others, some of the benefits of using this tool:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Codeless:&lt;/strong&gt; forget about creating the interfaces/types for every GraphQL endpoints; save time and spend effort on what matters;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Development experience:&lt;/strong&gt; as a result of having the types always available, your editor will provide meaningful autocomplete and error checking;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Types always up-to-date:&lt;/strong&gt; if your GraphQL endpoint schemas change, your application will be updated and typescript will help you make sure you make the necessary changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;First of all, let's install the dependencies needed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i @apollo/react-hooks graphql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i @graphql-codegen/cli @graphql-codegen/import-types-preset @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typescript-react-apollo &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'm considering the following folder structure, but of course, feel free to adapt it to your liking, just have in mind that it needs a place to store the schemas that will be fetched by the Code Generator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;📦 my-project
┣ 📂 src
┃ ┣ 📂 pages
┃ ┃ ┗ index.tsx
┃ ┣ 📂 queries
┃ ┃ ┣ 📂 autogenerate
┃ ┃ ┗ my-query.gql
┃ ┗ apollo-client.ts
┣ codegen.yml
┗ package.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, basically, you'll need to create a configuration file at the root of the project, named codegen.yml. The following snippet shows how I usually set it up in my projects, where it generates different files for its own purpose, in other words, split by concerns like GraphQL operations and server schemas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Endpoint API, the following URL is a example&lt;/span&gt;
&lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://countries-274616.ew.r.appspot.com/graphql/&lt;/span&gt;
&lt;span class="na"&gt;overwrite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="c1"&gt;# Format files&lt;/span&gt;
&lt;span class="na"&gt;hooks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;afterAllFileWrite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;prettier --write&lt;/span&gt;
&lt;span class="na"&gt;generates&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# Get schemas from server&lt;/span&gt;
  &lt;span class="s"&gt;src/queries/autogenerate/schemas.tsx&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;documents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;src/queries/**/**.gql'&lt;/span&gt;
    &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;typescript&lt;/span&gt;
  &lt;span class="c1"&gt;# Create operations based on queries&lt;/span&gt;
  &lt;span class="s"&gt;src/queries/autogenerate/operations.tsx&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;documents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;src/queries/**/**.gql'&lt;/span&gt;
    &lt;span class="na"&gt;preset&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;import-types&lt;/span&gt;
    &lt;span class="na"&gt;presetConfig&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;typesPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./schemas&lt;/span&gt;
    &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;typescript-operations&lt;/span&gt;
  &lt;span class="c1"&gt;# 1. Export GraphQL documents&lt;/span&gt;
  &lt;span class="c1"&gt;# 2. React interface&lt;/span&gt;
  &lt;span class="s"&gt;src/queries/autogenerate/hooks.tsx&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;documents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;src/queries/**/**.gql'&lt;/span&gt;
    &lt;span class="na"&gt;preset&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;import-types&lt;/span&gt;
    &lt;span class="na"&gt;presetConfig&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;typesPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./operations&lt;/span&gt;
    &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;typescript-react-apollo&lt;/span&gt;
    &lt;span class="na"&gt;config&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# Optionals&lt;/span&gt;
      &lt;span class="na"&gt;withHOC&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
      &lt;span class="na"&gt;withComponent&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
      &lt;span class="na"&gt;withHooks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, let's add the scripts to generate the schemas and watch the files change in package.json:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&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;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schemas"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"graphql-codegen --config codegen.yml"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schemas:watch"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npm run schemas -- --watch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And as it turns out in the editor code:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tBA_NaEi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pyajp9i01gsl4rvkj9qb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tBA_NaEi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pyajp9i01gsl4rvkj9qb.gif" alt="Live coding"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is only one of the possible ways to use it, as it has many plugins, presets, integrations, and configurations, for different purposes such as to generate React higher-order component, Gatsby integration, prettier and lint the files, among other cool things. Feel free to check out the documentation &lt;a href="https://graphql-code-generator.com/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've made a repository available with the code above, and you can &lt;a href="https://github.com/danilowoz/ts-gql-jsx"&gt;check it out here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://danilowoz.com/"&gt;danilowoz.com&lt;/a&gt;&lt;/p&gt;




</description>
      <category>graphql</category>
      <category>react</category>
      <category>typescript</category>
      <category>reacthooks</category>
    </item>
    <item>
      <title>The main challenges you're likely to face when creating a crypto wallet on React Native</title>
      <dc:creator>Danilo Woznica</dc:creator>
      <pubDate>Mon, 23 Mar 2020 23:13:39 +0000</pubDate>
      <link>https://forem.com/danilowoz/the-main-challenges-you-re-likely-to-face-when-creating-a-crypto-wallet-on-react-native-5d82</link>
      <guid>https://forem.com/danilowoz/the-main-challenges-you-re-likely-to-face-when-creating-a-crypto-wallet-on-react-native-5d82</guid>
      <description>&lt;p&gt;&lt;a href="https://dribbble.com/Fredjesus1"&gt;&lt;sup&gt;&lt;em&gt;Cover image by Fred Jesus&lt;/em&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Crypto wallets and Decentralised Applications (&lt;a href="https://blockgeeks.com/guides/dapps/"&gt;dApp's&lt;/a&gt;) are becoming more popular each day. It is already possible to find a lot of industries adopting a decentralized approach: financial business, social networks, insurance, supply chain, only to mention a few.&lt;/p&gt;

&lt;p&gt;Also, the benefits of introducing blockchain technology on mobile devices, for example, are evident enough, and apparently worth the effort for companies which are willing to invest in their development. Factors like immutability, transparency, and security are concepts that, not only users but also business owners, recognise as a must when pondering about digital products.&lt;/p&gt;

&lt;p&gt;There is a lot of fuss around React Native versus native apps – and even though that's an entirely different issue – in our understanding, when budget is somehow the matter of interest, React Native is arguably the go-to choice. However, when it comes to implementing blockchain technologies with &lt;a href="https://reactnative.dev/"&gt;React Native&lt;/a&gt;, the uncertainties are unquestionable: it's a fairly recent environment which still somehow lacks expert developers out there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;We set ourselves to challenge precisely that.&lt;/p&gt;

&lt;p&gt;When we were presented with &lt;a href="https://www.vertbase.com/"&gt;Vertbase&lt;/a&gt;, a project which entailed the concerns we just mentioned above, our thoughts were with React Native. Straight off the bat.&lt;/p&gt;

&lt;p&gt;However, it was far from being a walk in the park. Even though we've undergone a lot of development in ReactJS, React Native was at the time somewhat new to us and topping it up with blockchain technology, could have been a shot in the leg.&lt;/p&gt;

&lt;p&gt;But fear not!&lt;/p&gt;

&lt;p&gt;A few hours later and it was perceptible just how efficiently React Native bridged the gap between JavaScript and the Native Modules of both iOS and Android Operating Systems.&lt;/p&gt;

&lt;p&gt;With this, and being given the challenge of building a non-custodial wallet that is meant to support a few Crypto assets, asset transactions, and create new wallets – amongst other features – it ended up being a pretty solid App.&lt;/p&gt;

&lt;p&gt;However, it was far from a relaxing project. The initial time estimate felt – truly – short due to all the investigation we had to perform. This was because of all the unexpected problems we had to face throughout the entire timeframe of development, which at the time were completely unlike anything we had faced before. Often, we had to rely on the open-source community which had previously done an amazing job at some React Native and blockchain libraries.&lt;/p&gt;

&lt;h2&gt;
  
  
  The issues
&lt;/h2&gt;

&lt;p&gt;As an act of reciprocity, we'll guide you through some of the bigger issues we faced whilst developing the application. Also worth mentioning, the list below is still work in progress as we're certain further issues will pop up every day, from Operating System updates to the deprecation of some libraries we've used, as well as potential security vulnerabilities which may arise.&lt;/p&gt;

&lt;h3&gt;
  
  
  JavaScriptCore
&lt;/h3&gt;

&lt;p&gt;If you have past experience with React Native, it's likely you'll know that it runs a specific version of the JavaScript Engine – &lt;a href="https://developer.apple.com/documentation/javascriptcore"&gt;JavaScriptCore&lt;/a&gt;, which Safari is built on.&lt;/p&gt;

&lt;p&gt;Therefore, as some JavaScript functions are not yet available in JavaScriptCore, naturally as a consequence, some of the most popular JavaScript packages relevant for this kind of product – such as generating wallets or broadcasting transactions to the network – to this date, are not yet available in JavaScriptCore, meaning it's not ready to be used with React Native.&lt;/p&gt;

&lt;p&gt;However, such packages are available for NodeJs instead. Initially, what could have been a nightmare turned out plausible – once more, with the help of the community, we got to some workarounds which made possible bringing those functions from NodeJS to React Native.&lt;/p&gt;

&lt;h3&gt;
  
  
  Technical debt
&lt;/h3&gt;

&lt;p&gt;Things like hierarchical deterministic wallet, BIP32, BIP44, WIF, private key, address keys, lightning network, just to mention a few amongst other subjects you probably haven't heard of.&lt;/p&gt;

&lt;p&gt;Perhaps these may – or may not – be the sole reason why one hasn't built a thing on top of the blockchain technology.&lt;/p&gt;

&lt;p&gt;Even though throughout this journey, we found a lot of articles, videos, talks, crash courses, and documentation which provided us with the required information to understand the basics of the blockchain infrastructure, the practical reality is utterly different. In fact, the community lacks realistic examples on how to build applications for the real world, especially on popular languages for the web, such as JavaScript – which on its own is not so popular within the blockchain universe.&lt;/p&gt;

&lt;h3&gt;
  
  
  Asset implementation
&lt;/h3&gt;

&lt;p&gt;Most crypto assets require their own dedicated implementation. Moreover, each requires dedicated libraries and/or frameworks to connect JavaScript and blockchain technology.&lt;/p&gt;

&lt;p&gt;Depending on how many cryptocurrencies any given product is meant to support, the complexity may increase. In fact, there's not a one-size-fits-all when it comes to crypto assets. Almost each of them requires a dedicated, standalone process to get the connectivity going. Truth be told, have in mind that you'll have to implement one asset at a time while making sure it has JavaScript support.&lt;/p&gt;

&lt;p&gt;In short, there isn't a single solution that covers every single cryptocurrency out there, at least when the goal is to remain decentralized. Even though you might – correctly – assume a big portion of the assets are built on the same infrastructure – extended from others, per se – every single one of them will require basic implementation and adaptation from previously integrated assets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Public code validation
&lt;/h3&gt;

&lt;p&gt;It isn't necessarily a rule, neither is this compulsory, but users withing the blockchain community are keen to validate application codebases before putting any extra effort into it, making sure such applications are secure and trustworthy.&lt;/p&gt;

&lt;p&gt;Therefore, keep in mind it might make sense to Open-source the code at some point. It will be scrutinised by its users, but that's just a good thing – you'll push yourself towards a better, well-documented codebase.&lt;/p&gt;

&lt;p&gt;On the flip-side of the coin, make sure all sensitive data or non-meant-to-be-public information is safely located somewhere else and not exposed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security - responsibility
&lt;/h3&gt;

&lt;p&gt;People's money is on the line with these kinds of applications. Naturally, security is a fundamental concern when developing financial applications.&lt;/p&gt;

&lt;p&gt;Users will be performing transactions, storing wallets' access keys, and even generating new ones. Due to the nature of these products, development must be responsible and lucid as every decision matters – even those that sometimes seem like no-brainers may be extremely relevant when it comes to security. Bottom line, there are no dumb questions or obvious answers when security and money are on the line.&lt;/p&gt;

&lt;p&gt;On top of this, as you might have guessed by now, Open-source codebases can become an issue if you're not careful enough. Be extra careful when adding third-party party dependencies, beware of vulnerabilities or security breaches.&lt;/p&gt;

&lt;p&gt;It's also worth pointing out that you should keep in mind that React Native and regular ReactJS – or the entire web environment as a whole – are deeply different at some point. A straight-forward issue on the web might be trickier than expected to deal with on React Native. For example, when developing these kinds of products, as you know, data must be stored locally on the device. For that matter, it must be placed in a safe, concealed place in order to avoid exposure to malicious users. With regards to this, make sure you choose the right approach to deal with the right kind of data.&lt;/p&gt;

&lt;h2&gt;
  
  
  One possible approach
&lt;/h2&gt;

&lt;p&gt;There isn't a shortcut when it comes to developing React Native Apps in the blockchain. A lot of issues were solved, but a lot more will arise. That's just the nature of new technologies, nobody is 100% certain. There isn't a formula to help you smooth your way through this kind of project, there's just too much to consider and too many variables in the mix.&lt;/p&gt;

&lt;p&gt;However, there are some points we've learned with this experience which we can recommend for you to take a look at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Codebase reliability:&lt;/strong&gt; make sure the codebase is type-safe, has great test coverage, handles errors properly, and is built on top of an architecture prepared to be scaled. Languages like Typescript or a tool like Flow will definitely help you on this path;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security-driven development:&lt;/strong&gt; keep all dependencies up-to-date. More often than not, security issues are identified and to tackle that, new package versions are released. Also, have a careful, thorough look at each package or library before settling for a specific one: see Open and Closed issues, how many projects are using it, who else is using it too, which dependencies are being made use of, and so forth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Try. Start small, aim big:&lt;/strong&gt; on the very first stage, take enough time to learn more about blockchain and how to implement it. There's a lot of content available out there, make sure you know where to start your research and, above all, what to search for. Don't hold back on moving on if you feel like so. Learning will come from the mistakes you make. Nevertheless, start small, aim big. Start with some small code samples to try out some basic concepts before moving on to the hardcore stuff.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open-source, open mindset:&lt;/strong&gt; Share your code with the community and ask for feedback. Let more experienced developers help you out. You may be or you may become more experienced than others, and for this matter, spread your knowledge, help them as well. Write articles, open-source your code, help other people grow. There are still a whole lot of unanswered topics when it comes to blockchain - jump-start discussions, call blockchain experts, make sure you're on the right path to help make sure others are on the right path.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bottom line, we faced a bunch of problems while developing a Cryptocurrency App in the Blockchain using React Native. It had its ups and downs, but in the end, it was extremely rewarding. We've learned a lot with our own mistakes, we spent hours figuring out one single deployment, but in the end, the whole thing got sorted. We hope we're paving the way for those who follow.&lt;/p&gt;

&lt;p&gt;In case you have any questions or facing any issues, feel free to get in touch with us.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://danilowoz.com/"&gt;danilowoz.com&lt;/a&gt;&lt;/p&gt;




</description>
      <category>blockchain</category>
      <category>reactnative</category>
      <category>cryptowallet</category>
      <category>cryptocurrency</category>
    </item>
  </channel>
</rss>
