<?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: Eduard Andrei Capanu</title>
    <description>The latest articles on DEV Community by Eduard Andrei Capanu (@razxssd).</description>
    <link>https://dev.to/razxssd</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%2F330987%2Fe201b349-3ac0-4139-bbdb-cd1bcae23fee.jpg</url>
      <title>DEV Community: Eduard Andrei Capanu</title>
      <link>https://dev.to/razxssd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/razxssd"/>
    <language>en</language>
    <item>
      <title>Which E2E Tool to Use with React?</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Tue, 18 Jun 2024 14:34:04 +0000</pubDate>
      <link>https://dev.to/razxssd/which-e2e-tool-to-use-with-react-5173</link>
      <guid>https://dev.to/razxssd/which-e2e-tool-to-use-with-react-5173</guid>
      <description>&lt;p&gt;When it comes to testing the end-to-end (E2E) integration of web applications, choosing the right tools is crucial to ensure comprehensive test coverage and optimal software quality.&lt;/p&gt;

&lt;p&gt;I found this sentence online and it seems the most suitable given our context.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If your test is difficult to write, your design is bad" - Randomly Software Engineer&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's why I decided to do a brief analysis, a bit closer, of some of the main E2E tools available on the market and their characteristics.&lt;/p&gt;

&lt;p&gt;However, the entire analysis will be based on their compatibility with React.&lt;/p&gt;




&lt;p&gt;After various analyses, the ones I found primarily used were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Playwright&lt;/li&gt;
&lt;li&gt;Cypress&lt;/li&gt;
&lt;li&gt;SauceLabs&lt;/li&gt;
&lt;li&gt;Testim&lt;/li&gt;
&lt;li&gt;Puppeteer + Jest&lt;/li&gt;
&lt;/ul&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%2F8k3813qm8pna3mj6jd0a.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%2F8k3813qm8pna3mj6jd0a.png" alt="e2e testing tools"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Playwright
&lt;/h2&gt;

&lt;p&gt;Playwright is an open-source automation library that allows testing web applications across different browsers and devices. &lt;br&gt;
It is suitable for use with JavaScript React and offers a wide range of features for automating tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strengths
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-browser and multi-device&lt;/strong&gt;: supports testing on a wide range of browsers and devices, including Chrome, Firefox, Safari, and mobile devices like iPhone and Android.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execution speed&lt;/strong&gt;: it is known for its fast execution speed due to its efficient automation engine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Powerful API&lt;/strong&gt;: It offers a powerful and flexible API that allows writing complex and high-quality tests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Snapshot testing&lt;/strong&gt;: Supports snapshot testing to allow visual comparison of user interfaces.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated regression testing&lt;/strong&gt;: Playwright's automated tests can be integrated into the CI/CD pipeline to check that the new code has not broken existing functionality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parallel testing for faster execution&lt;/strong&gt;: It is able to run multiple tests simultaneously to reduce execution time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Weaknesses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Steep learning curve&lt;/strong&gt;: The learning curve might be steep for new users due to its flexibility and power.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-web applications&lt;/strong&gt;: Playwright is specifically designed for web applications. &lt;/li&gt;
&lt;li&gt;For native desktop or mobile native application testing, other tools would be more suitable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limited resources / Simple projects&lt;/strong&gt;: Not suitable for simple web projects, the overhead of setting up and maintaining Playwright might not be justified.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cypress
&lt;/h2&gt;

&lt;p&gt;Cypress is a modern end-to-end testing framework designed specifically for web applications. &lt;br&gt;
It offers a comprehensive set of features for writing, running, and debugging tests in real-time, including the ability to perform mocking.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strengths
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ease of use&lt;/strong&gt;: Cypress is known for its ease of use and simplicity in configuring and writing tests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-time testing&lt;/strong&gt;: It offers the ability to see the test in real-time during execution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple debugging&lt;/strong&gt;: It has built-in features for debugging tests, making it easier for developers to identify and fix issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mocking and stubbing&lt;/strong&gt;: Cypress offers built-in features for mocking and stubbing network requests.&lt;/li&gt;
&lt;li&gt;Using the &lt;strong&gt;cy.request()&lt;/strong&gt; command, Cypress isolates API interactions, facilitating a clearer separation between UI and API interactions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Weaknesses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limited browser support&lt;/strong&gt;: Currently, browser support is limited to Chrome and Firefox.&lt;/li&gt;
&lt;li&gt;Cypress's &lt;strong&gt;cy.request()&lt;/strong&gt; focuses on response mimicking and does not provide detailed network interaction control.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  SauceLabs
&lt;/h2&gt;

&lt;p&gt;Sauce Labs is a cloud-based platform for automated testing of web and mobile applications. &lt;br&gt;
It offers a wide range of features for running tests in parallel, testing on different browsers and devices, and integrating with continuous integration (CI) tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strengths
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Testing&lt;/strong&gt;: Sauce Labs offers the ability to run tests on a wide range of devices and browsers in the cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compatibility&lt;/strong&gt;: It offers excellent compatibility with a wide range of browsers and devices, including mobile devices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parallel and distributed&lt;/strong&gt;: It allows parallel and distributed execution of tests, reducing overall execution times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration with CI/CD&lt;/strong&gt;: It is well integrated with continuous integration (CI) and continuous deployment (CD) tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Weaknesses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt;: It may be costly compared to other solutions, especially if running tests on a large number of browser/device configurations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complex setup&lt;/strong&gt;: Initial setup may be complex due to its cloud-based nature.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Testim
&lt;/h2&gt;

&lt;p&gt;Testim is an AI-driven testing platform that automates the creation, execution, and maintenance of tests. &lt;br&gt;
It uses AI to analyze application behavior and generate test scripts automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strengths
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AI-driven testing&lt;/strong&gt;: Testim uses artificial intelligence to help create, execute, and maintain tests automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ease of use&lt;/strong&gt;: It is designed to be easy to use, with an intuitive interface that allows writing tests quickly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic test creation&lt;/strong&gt;: It can automatically record user actions and generate tests based on these actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test versioning&lt;/strong&gt;: It offers built-in test versioning, allowing tracking of test changes and iterations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Weaknesses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limited manual control&lt;/strong&gt;: Since it is AI-driven, it may not offer the desired level of manual control for some use cases, difficult to customize.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt;: Testim may also be costly, especially for smaller companies or projects with limited budgets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Puppeteer &amp;amp; Jest
&lt;/h2&gt;

&lt;p&gt;Puppeteer is a Node.js library developed by Google that provides a high-level API to control headless Chrome or Chromium instances. &lt;br&gt;
It is suitable for testing React applications, especially in end-to-end testing scenarios that require interaction with the browser's DOM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strengths
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Full control over the browser&lt;/strong&gt;: It provides a high-level API that allows full control over headless Chrome or Chromium instances. 
This enables to perform a wide range of tasks, including navigation, interaction with the DOM, form submissions, and more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Support for modern web features&lt;/strong&gt;: supports the latest web standards and features, making it suitable for testing modern web applications built with technologies like React, Angular, Vue.js, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Integration with Chrome DevTools&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Headless mode&lt;/strong&gt;: can run Chrome or Chromium in headless mode, which means it operates without a graphical user interface. 
This makes it ideal for running tests in headless environments such as continuous integration (CI) pipelines.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Weaknesses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limited cross-browser support&lt;/strong&gt;: is primarily designed for testing with Chrome or Chromium browsers. 
While it can be used with other browsers via the WebDriver protocol, support for non-Chromium browsers may be limited.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource-intensive&lt;/strong&gt;: requires the installation of a full Chrome or Chromium browser, which can consume significant system resources, especially when running multiple instances in parallel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Steep learning curve&lt;/strong&gt;: Puppeteer's API can be complex, especially for beginners. Users may need to invest time in learning how to use Puppeteer effectively for their testing needs.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;In the next article, we will compare 2 of these technologies to see which one might be a better choice based on our context.&lt;br&gt;
I hope the article was helpful, let me know if you know of other similar tools or if you use one different from those mentioned :)&lt;/p&gt;




&lt;h2&gt;
  
  
  End
&lt;/h2&gt;

&lt;p&gt;I post once a week on React that I share via LinkedIn, follow me for more information and tips.&lt;/p&gt;

&lt;p&gt;LinkedIn: &lt;a href="https://www.linkedin.com/in/eduardcapanu/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/eduardcapanu/&lt;/a&gt;&lt;br&gt;
X (Twitter): &lt;a href="https://twitter.com/capanu2" rel="noopener noreferrer"&gt;https://twitter.com/capanu2&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>playwright</category>
      <category>testing</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to use multiple files for configuring environment variables in React</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Mon, 06 May 2024 10:21:47 +0000</pubDate>
      <link>https://dev.to/razxssd/how-to-use-multiple-files-for-configuring-environment-variables-in-react-3h2p</link>
      <guid>https://dev.to/razxssd/how-to-use-multiple-files-for-configuring-environment-variables-in-react-3h2p</guid>
      <description>&lt;p&gt;Sometimes I happened to have conflicts in the merge phase every time I modified those files that contained different properties for each environment.&lt;br&gt;
For a long time I continued with this approach, resolving conflicts by hand thinking it was the right thing.&lt;/p&gt;

&lt;p&gt;But looking online a bit I realized that there were many solutions, only that I didn't use any of them 😁.&lt;/p&gt;

&lt;p&gt;In this article we will see how to configure and use different configuration files for environment variables.&lt;/p&gt;




&lt;p&gt;Let's imagine we have 3 environments, one for &lt;strong&gt;development&lt;/strong&gt;, one for &lt;strong&gt;system test&lt;/strong&gt; and one for &lt;strong&gt;production&lt;/strong&gt;.&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%2Fnxk7k57isnwa2vtewrq1.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%2Fnxk7k57isnwa2vtewrq1.png" alt="3 envs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A classic division on the code side would be to create a repository with 3 branches inside, one for each environment.&lt;/p&gt;

&lt;p&gt;Now suppose we need to interact with backend services with different endpoints in each environment (different endpoints).&lt;br&gt;
To do this, our 3 branches will probably never be completely aligned, right?&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%2Flollabg12vv1m19azmpg.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%2Flollabg12vv1m19azmpg.png" alt="envs with endpoind"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By implementing a multiple file system for managing environment variables we could create 3 files on each branch:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;.env.dev&lt;/li&gt;
&lt;li&gt;.env.sit&lt;/li&gt;
&lt;li&gt;.env.prod&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These files will all have a variable that we will call &lt;strong&gt;REACT_APP_BACKEND_URL&lt;/strong&gt; (we use the REACT_APP prefix only because it is required by the library itself) and which will contain the value of the right endpoint to use.&lt;/p&gt;

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

REACT_APP_BACKEND_URL=dev-sample


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

&lt;/div&gt;

&lt;p&gt;In this way the application on each branch will have the exact same source.&lt;/p&gt;

&lt;p&gt;The only thing we are missing is to start / build the app with one configuration file rather than another and change the endpoints within the app dynamically like this for example:&lt;/p&gt;

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

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;backend_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`https://&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;REACT_APP_BACKEND_URL&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;To solve the problem I will use the &lt;a href="https://www.npmjs.com/package/env-cmd" rel="noopener noreferrer"&gt;env-cmd&lt;/a&gt; library, thanks to it we can define via a script inside the package.json file which configuration file to read.&lt;/p&gt;

&lt;p&gt;First, the library must be installed by launching:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install env-cmd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let's add these 3 commands to the scripts tag, inside the &lt;strong&gt;package.json&lt;/strong&gt; file.&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;"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="nl"&gt;"start:dev"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.dev react-scripts start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"start:sit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.sit react-scripts start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"start:prod"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.prod react-scripts start"&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="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;Thanks to the keyword &lt;strong&gt;-f&lt;/strong&gt; we indicate the file from which to read the variables and then proceed with the normal start of the application.&lt;/p&gt;

&lt;p&gt;This approach is very useful for several reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can test the new features with production services directly locally without having to change anything, just launch the command:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm run start:prod&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you have pipelines for automatic build and deployment, you can create 3 other similar commands and decide to build with the right endpoints based on the pipeline launched.&lt;/li&gt;
&lt;/ul&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;"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="nl"&gt;"start:dev"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.dev react-scripts start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"start:sit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.sit react-scripts start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"start:prod"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.prod react-scripts start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"build:dev"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.dev npm run build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"build:sit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.sit npm run build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"build:prod"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"env-cmd -f .env.prod npm run build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"react-scripts build"&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="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


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

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;You can implement hidden features for certain environments and simulate what is done via feature flags, directly on the client side.
Giving only the application running in development and system test the opportunity to test a new feature, while also bringing the source into production.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you liked the post or if you are interested in learning more about the topic, tell me below, so that I can make a video or similar articles based on the different use cases 😉.&lt;/p&gt;

</description>
      <category>react</category>
      <category>coding</category>
      <category>package</category>
      <category>environmentvariables</category>
    </item>
    <item>
      <title>ReactTS: Is React.FC really necessary?</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Mon, 06 May 2024 10:10:30 +0000</pubDate>
      <link>https://dev.to/razxssd/reactts-is-reactfc-really-necessary-38ng</link>
      <guid>https://dev.to/razxssd/reactts-is-reactfc-really-necessary-38ng</guid>
      <description>&lt;p&gt;Today we often see the use of the FC (FunctionComponent) type in tutorials, courses, videos on YouTube, which deal with topics on React TypeScript.&lt;/p&gt;

&lt;p&gt;At first I didn't pay any attention to it, it was something that everyone used so it was obviously fine to include it in my projects too :D.&lt;br&gt;
Over time, by reading and learning more about the development of React applications through &lt;strong&gt;Function Components&lt;/strong&gt;, I discovered that it is possible to return JSX, or in our case, TSX, even by not typing a function correctly.&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="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IAppProps&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&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;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;IAppProps&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  So the question arises spontaneously, what is the point of typing our component with FC?
&lt;/h2&gt;

&lt;p&gt;There are a couple of advantages, that's for sure, let's go and see them together:&lt;br&gt;
1) Our component function would become Type-Safe, it would give us an error trying to return a type other than a &lt;strong&gt;JSX.Element&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="c1"&gt;// no error is raised on the function&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;IAppProps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;`Hello &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&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="c1"&gt;// an error is raised if you accidentally return some other type&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;IAppProps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;`Hello &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2) We have access to &lt;strong&gt;children&lt;/strong&gt; implicitly within the props (Not everyone considers this to be an advantage, so let's see it as a 'feature' of &lt;strong&gt;React.FC&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="cm"&gt;/* 
without any additional interface we can access 'children' directly from props
*/&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;We can immediately notice that the list is quite short, furthermore, by reading the &lt;a href="https://react-typescript-cheatsheet.netlify.app/docs/basic/setup/"&gt;React TypeScript documentation&lt;/a&gt;, we see that there are alternatives to what React.FC uses by default.&lt;/p&gt;

&lt;p&gt;As an alternative to &lt;strong&gt;point 1&lt;/strong&gt;, we can manually type the type returned by our component function.&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="cm"&gt;/*
you can choose annotate the return type so an error is raised if you accidentally return some other type
*/&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;IAppProps&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;JSX&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Element&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&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;As an alternative to &lt;strong&gt;step 2&lt;/strong&gt;, we can manually add children to the component interface like this:&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="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IAppProps&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nl"&gt;JSX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;Element&lt;/span&gt;&lt;span class="p"&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;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;IAppProps&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      Hello &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;!
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&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;Also true is the fact that probably, if we were to use the children property, it would be better for us to implement &lt;strong&gt;React.FC&lt;/strong&gt;, so we save ourselves the manual typing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Ok, but are there any disadvantages to continuing to use React.FC?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Children passed even when you don't need it&lt;/strong&gt;&lt;br&gt;
The first thing I found is that children can be passed even if the component doesn't use them.&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;React.FC&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="c1"&gt;// Don't want children&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&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="cm"&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;App&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="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="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Unwanted Item&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&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;Typing manually:&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="c1"&gt;// Don't want children&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;JSX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;Element&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&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;App&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="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="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; // Will throw an error
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Unwanted Item&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&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;&lt;strong&gt;2. Does not support generics&lt;/strong&gt;&lt;br&gt;
If desired, you can create components by defining generics in the interface&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="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IAppPropsGeneric&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;appList&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&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;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;IAppPropsGeneric&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/*...*/&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using React.FC there is no way to keep the generics in the types returned by the function.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="cm"&gt;/*??*/&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;(props: IAppProps&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;) =&amp;gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/*...*/&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Does not work well with defaultProps&lt;/strong&gt;&lt;br&gt;
As is also described directly on the &lt;a href="https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components/"&gt;react-typescript site&lt;/a&gt;, there are known problems with using defaultProps using React.FC.&lt;/p&gt;

&lt;p&gt;Let's take the example of a component that has a required input property and uses &lt;strong&gt;defaultProps&lt;/strong&gt; to define its default value.&lt;br&gt;
We will do an example without &lt;strong&gt;React.FC&lt;/strong&gt; and one with, using the same interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;IHeaderProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&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;Without React.FC things would be fine&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;IHeaderProps&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; /* Safe since title is required */
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;defaultProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&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 everyone!&lt;/span&gt;&lt;span class="dl"&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;App&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="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;/&amp;gt;)&lt;/span&gt; 
&lt;span class="cm"&gt;/* Safe to omit 'title' since already has a default value */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's see how it would behave using &lt;strong&gt;React.FC&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;IHeaderProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; /* Safe since title is required */
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;defaultProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;title&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 everyone!&lt;/span&gt;&lt;span class="dl"&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;App&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="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;/&amp;gt;)&lt;/span&gt; 
&lt;span class="cm"&gt;/* Error thrown here saying that propery title is missing */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Basically you can't use &lt;strong&gt;defaultProps&lt;/strong&gt; to define i*&lt;em&gt;nternally required&lt;/em&gt;* and &lt;strong&gt;externally optional&lt;/strong&gt; properties.&lt;/p&gt;

&lt;p&gt;The only way to get the desired result would be to use the default value directly in the destructoring on the input properties, and define the property as optional on the interface, like this&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="c1"&gt;// Use of ? for optional parameter&lt;/span&gt;
&lt;span class="nx"&gt;type&lt;/span&gt;  &lt;span class="nx"&gt;IHeaderProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Add deafult value on destructoring&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;IHeaderProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Default Value&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;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="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; 
    // Safe since title is required and has a default value
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&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;App&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="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;/&amp;gt;)&lt;/span&gt; 
&lt;span class="cm"&gt;/* Safe now cause the default value was defined internally */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But this doesn't solve the &lt;strong&gt;defaultProps&lt;/strong&gt; problem, it just offers us an alternative :(&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What to do then?&lt;/strong&gt;&lt;br&gt;
Finally, I leave you with the alternative to using &lt;strong&gt;React.FC&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const AppWithFC: React.FC&amp;lt;IAppProps&amp;gt; = (props) =&amp;gt; { /*...*/ }
const App = (props: IAppProps): JSX.Element =&amp;gt; { /*...*/ };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All this to say that it is not strictly necessary to use it, there are alternatives to returning valid JSX.&lt;br&gt;
And if you want to use children, you can add input properties to the interface or use React.FC, however, I would like to point out that the documentation discourages their use nowadays.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc31uxler02p4e14ioshg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc31uxler02p4e14ioshg.png" alt="React.FC from documentation" width="800" height="96"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using React.FC, children will most likely be removed from implicit parameters on props, from version 18.0.0 onwards of @types/react.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzvi8pvu70tu7ztlobnh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzvi8pvu70tu7ztlobnh.png" alt="fc from documentation" width="800" height="65"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I hope I have given you some ideas :)&lt;/p&gt;

&lt;p&gt;I understand that there are all kinds of materials online and often not everything we see being used en masse means it's the right thing to take into consideration.&lt;/p&gt;

&lt;p&gt;So I greet you and if you liked the article I would like to know your opinion on the topic.&lt;br&gt;
Do you use &lt;strong&gt;React.FC&lt;/strong&gt; within your projects? :D&lt;/p&gt;

&lt;p&gt;PS: I used it and still use it a lot, but don't tell anyone, thanks :)&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Redirect Your Online Success with Rebrandly: The Power of Customized Links</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Thu, 02 May 2024 14:49:55 +0000</pubDate>
      <link>https://dev.to/razxssd/redirect-your-online-success-with-rebrandly-the-power-of-customized-links-405n</link>
      <guid>https://dev.to/razxssd/redirect-your-online-success-with-rebrandly-the-power-of-customized-links-405n</guid>
      <description>&lt;p&gt;I am a person obsessed with personal branding. &lt;/p&gt;

&lt;p&gt;Even though mine is not yet at the level I would like, I am always looking for new ways that can boost my services, my image, and my voice.&lt;/p&gt;

&lt;p&gt;In this article, I present to you Rebrandly, an application and service that can help us primarily with the branding of our links.&lt;/p&gt;




&lt;p&gt;Rebrandly helps us in a completely customizable way to brand our links 100%.&lt;/p&gt;

&lt;p&gt;As we can see in the image below, through the platform, we unlock the full potential of short links, leading our brand where we want and giving our clients a clear idea of the service we offer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://support.rebrandly.com/hc/en-us/articles/223459547-What-is-Rebrandly"&gt;Image source here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdzcfg0szv313hthjg66.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdzcfg0szv313hthjg66.png" alt="Rebrandly link description" width="800" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During my use of the service, I noticed the following positive aspects that really helped me in sharing my materials and content through the web.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An easy and intuitive interface to use&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Link management capable of implementing and modifying up to the most advanced options, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UTM Builder&lt;/li&gt;
&lt;li&gt;Traffic Routing&lt;/li&gt;
&lt;li&gt;Retargeting scripts&lt;/li&gt;
&lt;li&gt;OpenGraph metadata&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nl51wqdr753fkba7akh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nl51wqdr753fkba7akh.png" alt="Rebrandly link management" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A clear view of analytics related to clicks, country/device, and platform of origin&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Great way for mass import of my links&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The possibility to create a page called 'Link Gallery' that displays our links in one place. &lt;br&gt;
Definitely useful for sharing, for example, on Instagram along with our various social channels or services that we offer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvpx247ihiykwq28uubqe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvpx247ihiykwq28uubqe.png" alt="Rebrandly Link Gallery" width="800" height="880"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;These are just some of the features I had the opportunity to delve into, but the system also offers other innovative features plus the opportunity to integrate it with external services or access internal APIs for development purposes.&lt;/p&gt;

&lt;p&gt;I hope the article seemed interesting to you and that you will consider Rebrandly to scale up your brand in the online world.&lt;/p&gt;

&lt;p&gt;If not, I would be curious to hear your opinion about it and discover what alternatives you have chosen for branding your links.&lt;/p&gt;




&lt;p&gt;Follow me on LinkedIn for more information and tips: &lt;a href="https://www.linkedin.com/in/eduardcapanu/"&gt;🔹Eduard Capanu&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rebrandly</category>
      <category>linkshortener</category>
      <category>branding</category>
      <category>linkgallery</category>
    </item>
    <item>
      <title>React: You Might Not Need Another Library</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Sat, 27 Apr 2024 14:18:49 +0000</pubDate>
      <link>https://dev.to/razxssd/react-you-might-not-need-another-library-129h</link>
      <guid>https://dev.to/razxssd/react-you-might-not-need-another-library-129h</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxp7y5hkh8uw57148ujn9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxp7y5hkh8uw57148ujn9.jpg" alt="React ecosystem" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the React ecosystem, it's easy to fall into the temptation of integrating a myriad of libraries to enhance functionality and simplify development. &lt;/p&gt;

&lt;p&gt;However, this often leads to an overload of dependencies and more challenging code management.&lt;/p&gt;

&lt;p&gt;In this brief reflection, we'll explore the concept that in many situations, you might not need to add another library.&lt;/p&gt;

&lt;p&gt;React offers a robust and flexible set of features that enables developers to build complex applications without the need for external libraries. &lt;/p&gt;

&lt;p&gt;It's essential to carefully evaluate whether adding a new library is truly necessary or if the same results can be achieved using React's native capabilities.&lt;/p&gt;




&lt;p&gt;One of the primary reasons to limit the use of external libraries is the dependency on third parties. &lt;/p&gt;

&lt;p&gt;Each time we add a new library to our project, we increase the risk of compatibility issues, security vulnerabilities, and complications in the update process.&lt;/p&gt;

&lt;p&gt;Additionally, excessive library usage can bloat the application bundle, slowing down loading times and increasing browser resource consumption.&lt;/p&gt;

&lt;p&gt;Instead of seeking external solutions for every problem we encounter, it's beneficial to explore React's native capabilities and make the most of its features. Often, there are ways to achieve the same results using techniques already available in React, such as state management with useContext and useReducer, custom hooks, and optimized rendering patterns.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flok97vc0il6e9pcdb1m9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flok97vc0il6e9pcdb1m9.jpg" alt="Advantages of using ReactJs design Patterns" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Of course, there are cases where adding an external library may be justified, such as when dealing with complex or specific functionalities that are not easily implementable with React's native features.&lt;/p&gt;

&lt;p&gt;However, it's essential to carefully evaluate alternatives and consider the long-term effects on code architecture and maintainability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnqdopx8ofxuf2vmzt9o.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnqdopx8ofxuf2vmzt9o.jpg" alt="Thinking about your choice" width="540" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, the next time we're tempted to add another library to our React project, let's take a moment to reflect on whether it's genuinely necessary. We may discover that React's native solutions are more than sufficient to achieve our goals, reducing code complexity and improving application maintainability.&lt;/p&gt;




&lt;p&gt;Follow me on LinkedIn for more information and tips: &lt;a href="https://www.linkedin.com/in/eduardcapanu/"&gt;Eduard Capanu | LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactlibraries</category>
      <category>reactjsdevelopment</category>
    </item>
    <item>
      <title>React Developer Tools — So it really helps sometimes!</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Tue, 15 Mar 2022 19:20:41 +0000</pubDate>
      <link>https://dev.to/razxssd/react-developer-tools-ma-quindi-aiuta-davvero-2741</link>
      <guid>https://dev.to/razxssd/react-developer-tools-ma-quindi-aiuta-davvero-2741</guid>
      <description>&lt;p&gt;I'm that kind of person who, as soon as I start to delve into a new topic / framework / library, I go and do research on everything that could make studying or putting it into practice easier.&lt;br&gt;
In fact, I don't even know the extensions I downloaded in the first days of studying React, I'll just tell you that they were more extensions for React Native than for ReactJS 😁.&lt;/p&gt;

&lt;p&gt;Among all this plethora of tools I also downloaded React Developer Tools. (Link for&lt;a href="https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi"&gt; Chrome Web Store&lt;/a&gt;, &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/react-devtools/"&gt;Firefox Add-ons&lt;/a&gt; for Firefox, and &lt;a href="https://microsoftedge.microsoft.com/addons/detail/gpphkfbcpidddadnkolkpfckpihlkkil"&gt;Microsoft Edge Addons&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Obviously months went by without me using it at all, I didn't understand its potential and usefulness.&lt;br&gt;
And it is precisely for this reason that, after 1 and a half years now, I have decided to bring you some of the really useful features of this extension.&lt;/p&gt;




&lt;h2&gt;
  
  
  Functionalities
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Identification of an app developed in React&lt;/strong&gt;&lt;br&gt;
By visiting a web page you have the opportunity to see whether it was written in React or not.&lt;br&gt;
Let's take for example a sample page I made: &lt;a href="https://rx-google-keep.vercel.app/"&gt;Google Keep Clone Basic&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftpsue3h8u9kl3yn6z61y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftpsue3h8u9kl3yn6z61y.png" alt="Sample app" width="700" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just look at the color to understand that the app was written in React and uses a production build.&lt;/p&gt;

&lt;p&gt;Let's see an example of a page that doesn't use React instead.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fea1bqu17wvp8pdbbc4rf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fea1bqu17wvp8pdbbc4rf.png" alt="App withous react" width="700" height="75"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The exact same thing for local applications too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6k08ij2lruh611jvsjkc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6k08ij2lruh611jvsjkc.png" alt="App without react in local" width="700" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As from the message presented to us, we see that for those apps that use React, we have 2 new tabs available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Components tab&lt;/strong&gt;&lt;br&gt;
By opening the extension you have the opportunity to see how the application is actually structured and identify, for example, a problematic item on a list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcxetnlhwb84ic2o9tqzb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcxetnlhwb84ic2o9tqzb.png" alt="Developer tools tabs" width="700" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can pass properties to test how components work with different inputs or change the state of hooks such as useState().&lt;br&gt;
Very useful in case you have non-visible values ​​such as the 'isLoading' parameters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmm65fis8lzopf4bi2l2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmm65fis8lzopf4bi2l2.gif" alt="Example" width="1360" height="758"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A step forward for debugging for sure, enough with console.logs at every point of the application 😁.&lt;/p&gt;

&lt;p&gt;By inspecting a component you can also observe which part of the application rendered it, showing the components in cascade.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs1tpvi0n8uo96gdo3erg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs1tpvi0n8uo96gdo3erg.jpg" alt="Example of inspecting" width="700" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition to data inspection and manipulation, the tab comes with some interesting settings.&lt;br&gt;
It gives us the possibility to hide certain components from the list, if the app is very complex and large, change the theme, stop on wranings or decide to print all the information relating to a component in the console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2aju2uk9xb1ti0d70cat.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2aju2uk9xb1ti0d70cat.gif" alt="Example of rendering" width="680" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How many times have you had to print the input props to a component and write and rewrite console.log(props)?😁&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzf7kne0zvj5naqejlc1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzf7kne0zvj5naqejlc1.gif" alt="Example of props" width="680" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Profiler tab&lt;/strong&gt;&lt;br&gt;
Thanks to this tab we can identify and optimize the performance of our components, once started you will be listening to all the modifications and changes within the app.&lt;/p&gt;

&lt;p&gt;Initially the profiler could only be activated once the application had been loaded, thus losing the initial render, which is often the most problematic one.&lt;br&gt;
The issue was resolved later, with the introduction of the 'Reload and start profiling' button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpyj4u2dv3x3npcw078sg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpyj4u2dv3x3npcw078sg.png" alt="Profiling" width="700" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Which will refresh the page and start the profiler automatically.&lt;br&gt;
Let's see how it works though.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25cpu3upe0mgm60gxt2m.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F25cpu3upe0mgm60gxt2m.gif" alt="Profiler tab" width="1359" height="757"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The profiler will display a list of all items along with the loading time of each.&lt;br&gt;
They will then be colored differently based on the time taken and you will have the opportunity to identify those who take the longest to render their children or themselves.&lt;br&gt;
You can also notice if a component is rendered more than once, very useful for discovering superfluous renders.&lt;/p&gt;




&lt;p&gt;Debugging React applications can be difficult, especially when users encounter problems that are difficult to reproduce, so I think the extension can be very useful for several use cases.&lt;br&gt;
Both during development and later for performance optimization.&lt;/p&gt;

&lt;p&gt;If you liked the post, let me know in the comments, and if you would like to learn more about the topic, tell me below, so that I can make a video or an article in which I actually explain how to best use the profiler and the components tab based on different use cases 😉.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>reactdevelopertools</category>
    </item>
    <item>
      <title>5 Ways to Get Started with Azure</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Fri, 21 Jan 2022 13:29:15 +0000</pubDate>
      <link>https://dev.to/razxssd/5-modalita-per-iniziare-con-azure-3114</link>
      <guid>https://dev.to/razxssd/5-modalita-per-iniziare-con-azure-3114</guid>
      <description>&lt;p&gt;My boss told me to start using Azure…&lt;/p&gt;

&lt;p&gt;Ah no, this is not my story, you are certainly not interested in this, or are you? (let me know in the comments and we'll see how to solve it 😁)&lt;/p&gt;

&lt;p&gt;Most likely if you have arrived here it is either because you are interested or because you have to start studying Azure out of necessity.&lt;/p&gt;

&lt;p&gt;I understand you, there are many cloud services and you want to know more, such as Amazon Web Services, Google Cloud etc. (just to name the most famous).&lt;br&gt;
Well, let's say that Microsoft also has its fairly large market share, but we're not here to talk about that today, so let's get started.&lt;/p&gt;




&lt;p&gt;The platform offers over 100 cloud services and integrates seamlessly with other Microsoft products, many tech enthusiasts feel pressure to understand cloud platforms like Azure.&lt;br&gt;
But for beginners, the cloud can seem complex and overwhelming.&lt;/p&gt;

&lt;p&gt;This article will offer a complete guide to getting started with Azure.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Let's quickly learn the basic Azure terminology&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Azure Active Directory (AD)&lt;/strong&gt;&lt;br&gt;
Also known as &lt;strong&gt;tenant&lt;/strong&gt;, it is a set of network services based on Microsoft's cloud and is intended to help users access resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subscription&lt;/strong&gt;&lt;br&gt;
A &lt;strong&gt;subscription&lt;/strong&gt; simply refers to the billing agreement between Microsoft and the customer.&lt;br&gt;
Each Azure subscription comes with a directory, but each directory can contain multiple subscriptions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource&lt;/strong&gt;&lt;br&gt;
The term &lt;strong&gt;resource&lt;/strong&gt; refers to the individual services offered by Azure, such as a virtual machine or a SQL database.&lt;br&gt;
However, the resources must be linked to a &lt;strong&gt;resource group&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Group&lt;/strong&gt;&lt;br&gt;
It typically manages resources that need to be protected, managed, and deployed as a whole.&lt;br&gt;
&lt;strong&gt;Resource Groups&lt;/strong&gt; can help you both organize your resources and create a safety boundary where necessary.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnrkw0cw01f0wmm8uzea.png" alt="Image description" width="700" height="350"&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Microsoft's Azure Fundamentals documentation (completely free)&lt;/strong&gt;&lt;br&gt;
One of the best ways to approach Azure is to start with their documentation.&lt;br&gt;
Microsoft offers many well-structured paths that can help both those who find themselves faced with a cloud platform for the first time and those who already have a good foundation in it.&lt;/p&gt;

&lt;p&gt;I recommend starting with Concepts &lt;a href="https://docs.microsoft.com/it-it/learn/paths/az-900-describe-cloud-concepts/"&gt;of Azure fundamentals Part 1&lt;/a&gt; and continue to part 6.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Courses on Pluralsight (paid)&lt;/strong&gt;&lt;br&gt;
If you are looking for video lessons and are good at English, Pluralsight is a platform specialized in distance learning to enrich your skills and be able to complete any project.&lt;/p&gt;

&lt;p&gt;The best path to start with to delve deeper into Azure is definitely &lt;a href="https://app.pluralsight.com/paths/certificate/microsoft-azure-fundamentals-az-900"&gt;Microsoft Azure Fundamentals&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At the time of writing the article the subscription costs €26 / month and €275 / year.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Video on Youtube (free of course)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On Youtube we really find so many useful videos, the problem is precisely the amount of content we find.&lt;br&gt;
I thought I'd make a list of videos that have helped me personally and that I've seen more than once.&lt;/p&gt;

&lt;p&gt;a. &lt;a href="https://youtu.be/99GOClDskYk"&gt;Introduction at Azure&lt;/a&gt; (with Fabio Biondi and Andrea Saltarello / Italiano) - Introductory video that explains a little about how Azure is structured internally, both in terms of resources and price, with practical examples too.&lt;/p&gt;

&lt;p&gt;b. &lt;a href="https://youtu.be/t-SgKyWLxsc"&gt;How to create an Azure account&lt;/a&gt; (English)&lt;/p&gt;

&lt;p&gt;c. &lt;a href="https://youtu.be/0QO2jdinCoQ"&gt;Create your first Web App on Microsoft Azure&lt;/a&gt; (English)&lt;/p&gt;

&lt;p&gt;d. &lt;a href="https://youtu.be/NKEFWyqJ5XA"&gt;Azure Fundamentals course by freeCodeCamp&lt;/a&gt; (English) — Overview of the topics covered in the exam to obtain the AZ-900 certification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. LinkedIn Learning (paid — free)&lt;/strong&gt;&lt;br&gt;
LinkedIn Learning sometimes surprises me, it is a platform that offers courses + exercises and a sometimes exceptional community.&lt;br&gt;
As soon as you finish a course on the platform you have access to chats where you can interact with those who have seen the same course/video. Furthermore, you have the opportunity to help and exchange points of view on the topic.&lt;/p&gt;

&lt;p&gt;The only negative point is the cost, which is quite high, but you can always try the free one-month version, in which you have full access to everything. It's definitely worth a try.&lt;br&gt;
Furthermore, at the end of each finished course you receive a LinkedIn badge which certifies the completion of the course.&lt;/p&gt;

&lt;p&gt;The video I liked the most was the one about preparing for the exam &lt;a href="https://www.linkedin.com/learning/exam-prep-microsoft-azure-fundamentals-az-900-2"&gt;Azure Funtamentals&lt;/a&gt;, in the end it included all the key points you need to know to be able to start taking the path towards the cloud in the Microsoft world.&lt;/p&gt;

&lt;p&gt;The link to the course &lt;a href="https://www.linkedin.com/learning/exam-prep-microsoft-azure-fundamentals-az-900-2"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;My Medium / LinkedIn profile obviously 😁 (free)
I often make/share posts on Frontend topics related to the Microsoft world, new technologies and reflections on work.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/eduardcapanu/"&gt;My LinkedIn profile&lt;/a&gt;.&lt;br&gt;
&lt;a href="https://medium.com/@capanueduard98"&gt;My Medium profile&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Going on the profile costs nothing 😊, if you liked the article I would be happy to hear your opinion in the comments.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>activeactivedirectory</category>
      <category>microsoft</category>
      <category>microsoftazure</category>
    </item>
    <item>
      <title>7 Signs you're a good programmer</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Sun, 09 Jan 2022 16:14:56 +0000</pubDate>
      <link>https://dev.to/razxssd/7-segni-che-sei-un-bravo-programmatore-2lc0</link>
      <guid>https://dev.to/razxssd/7-segni-che-sei-un-bravo-programmatore-2lc0</guid>
      <description>&lt;p&gt;I always wondered if I was a good programmer or not, the fact is that most developers are 'average'.&lt;/p&gt;

&lt;p&gt;For example, I'm not a good developer, but I try to improve my skills every day and put them into practice.&lt;/p&gt;

&lt;p&gt;Starting from this need, I wanted to find out how I could improve and what leads a developer to be above average.&lt;/p&gt;

&lt;p&gt;After reading various articles I was able to make a brief summary of the things that seemed most interesting to me.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;7 Signs You're a Good Developer&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.Try and experiment before asking&lt;/strong&gt;&lt;br&gt;
Instead of going for help at every obstacle, a good programmer first tries to solve the problem on his own.&lt;br&gt;
This prepares him to face problems in the future regardless of their difficulty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sintoms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You create and work on private/personal projects to better explore new features or to experiment with certain cases&lt;/li&gt;
&lt;li&gt;Think about alternative solutions with the aim of solving the problem encountered&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.You have a lot of patience&lt;/strong&gt;&lt;br&gt;
Sometimes it may happen that the environment in which you work is noisy or that due to many tasks / commitments or activities to carry out, you are a little mentally stressed.&lt;br&gt;
It must be remembered that a good programmer must have patience to fight with these situations and associate priorities with his activities.&lt;br&gt;
Most good programmers are tolerant and humble, attributes that help them fit in with the rest of the team, and produce fantastic work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sintoms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can predict a bug before running the code (it means you paid close attention to the code you wrote before running it)&lt;/li&gt;
&lt;li&gt;You don't know how many times your colleague went for a coffee or to the bathroom because of your concentration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3.You are hungry for knowledge&lt;/strong&gt;&lt;br&gt;
Developers who learn for their own interest are the best.&lt;br&gt;
Because consuming knowledge is an art and you cannot defeat hunger with pressure.&lt;/p&gt;

&lt;p&gt;Since our modern world is being filled with new technological innovations every second, a good programmer should have strong domain knowledge and should know multiple languages.&lt;br&gt;
There's little point in learning everything you need to know about a specific technology to be a good programmer.&lt;/p&gt;

&lt;p&gt;Since every technology present or coming in the future is nothing more than an evolved variant of something previous, if a programmer's skill set has continuously evolved over time and has an encyclopedic understanding, there is really no need to worry .&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sintoms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You focus less on promotion and money, and more on learning new things for yourself&lt;/li&gt;
&lt;li&gt;You always complain about product delivery times&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4.You teach&lt;/strong&gt;&lt;br&gt;
The best way to learn something is to know how to explain it to others, which is why teaching helps you understand a topic better and more deeply.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sintoms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You enjoy sharing new skills with others&lt;/li&gt;
&lt;li&gt;You like to bring conversations about new technologies/tools&lt;/li&gt;
&lt;li&gt;Sometimes reply on StackOverflow&lt;/li&gt;
&lt;li&gt;You help others solve their problems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5.You are always looking for perfection&lt;/strong&gt;&lt;br&gt;
Perfectionist developers often focus on performance, architecture, code cleanliness etc., they know that greatness will come after them if their work is perfect, and this is why they obsess.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sintoms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Would you be willing to do a substantial code refactor shortly before the deadline&lt;/li&gt;
&lt;li&gt;You always complain about product delivery times&lt;/li&gt;
&lt;li&gt;You don't like to compromise when it comes to code&lt;/li&gt;
&lt;li&gt;Check what you wrote 10 times before launching the application / software / product&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6.You are not attached to a specific tool/framework&lt;/strong&gt;&lt;br&gt;
In the end, the language and the framework are just tools.&lt;br&gt;
For a good programmer it is more important to first define the needs of the product and its architecture, and then continue with the technology that brings more advantages compared to the requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sintoms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assume your own code is the source of a bug before blaming the compiler, library, or operating system&lt;/li&gt;
&lt;li&gt;You don't care or depend 'too much' on a certain framework / tool&lt;/li&gt;
&lt;li&gt;Don't get involved in “language wars”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7.You are not emotionally involved in the code&lt;/strong&gt;&lt;br&gt;
We often get too attached to our code and sometimes we regret deleting/updating certain parts we've worked hard on.&lt;br&gt;
A good programmer is not emotionally attached to his code and makes necessary changes when needed without any regrets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sintoms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have no commented code within your software / application / product&lt;/li&gt;
&lt;li&gt;You refer to it as “the code” rather than “my code”&lt;/li&gt;
&lt;li&gt;You don't get defensive when someone tells you your code needs to be updated.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are actually many other signs of being a good programmer besides these 7 mentioned in this article.&lt;br&gt;
But surely the first thing you need to do is start trying and putting it into practice.&lt;/p&gt;

&lt;p&gt;Little by little you will get closer and closer to your goal 🙂&lt;/p&gt;

</description>
      <category>gooddeveloper</category>
      <category>developers</category>
      <category>programming</category>
      <category>goodprogrammer</category>
    </item>
    <item>
      <title>How to create a Power Apps Component Framework (PCF)</title>
      <dc:creator>Eduard Andrei Capanu</dc:creator>
      <pubDate>Mon, 09 Mar 2020 11:56:37 +0000</pubDate>
      <link>https://dev.to/razxssd/how-to-create-a-power-apps-component-framework-pcf-12nn</link>
      <guid>https://dev.to/razxssd/how-to-create-a-power-apps-component-framework-pcf-12nn</guid>
      <description>&lt;p&gt;Hi everyone, my name is Eduard and together with a dear friend of mine,&lt;br&gt;
Newton Urbanetz, we were trying last day to create our first PCF (PowerApps Component Framework).&lt;/p&gt;

&lt;p&gt;I must say that, to be a Microsoft component I expected to be documented in a much better way. In fact, some parts are not fully explained, I also found it difficult to find information in a single Microsoft Docs.&lt;br&gt;
With this article I hope to fill these empty spaces, to put all the information&lt;br&gt;
in one place and make everyone understand how to create their first PCF.&lt;/p&gt;

&lt;p&gt;So, let’s start this path together !&lt;/p&gt;

&lt;p&gt;We will go through 3 steps, firstly we will download all necessary files, then we will see how to create a simple static grid, and then publish it.&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%2Fmiro.medium.com%2Fmax%2F1970%2F1%2AqTrink55bg7Aqa1kbBHHzA.jpeg" 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%2Fmiro.medium.com%2Fmax%2F1970%2F1%2AqTrink55bg7Aqa1kbBHHzA.jpeg" alt="3 Steps"&gt;&lt;/a&gt;&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%2Fmiro.medium.com%2Fmax%2F2400%2F1%2AFUuD-Bdt-u-An2NkE9PQBQ.jpeg" 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%2Fmiro.medium.com%2Fmax%2F2400%2F1%2AFUuD-Bdt-u-An2NkE9PQBQ.jpeg" alt="Are you ready ?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What do you need to create a PCF project?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Firstly we need to install the Power Apps CLI, which gives us access to &lt;strong&gt;creation&lt;/strong&gt; / &lt;strong&gt;update&lt;/strong&gt; and &lt;strong&gt;deploy&lt;/strong&gt; functions of a custom control component.&lt;br&gt;
To do this, Microsoft gives us this &lt;em&gt;&lt;a href="https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/powerapps-cli" rel="noopener noreferrer"&gt;guide&lt;/a&gt;&lt;/em&gt;. But let’s do it together !&lt;/p&gt;

&lt;p&gt;1) We need to install &lt;em&gt;&lt;a href="https://nodejs.org/it/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt;&lt;/em&gt; and together it will come also installed NPM.&lt;/p&gt;

&lt;p&gt;What is Node.js?&lt;/p&gt;

&lt;p&gt;A framework that allows you to create server-side applications in Javascript, using an engine, called V8, which was made by Google, but this is not important for us, at least not now :)&lt;/p&gt;

&lt;p&gt;NPM instead is a package manager (Node.js Package Manager) tool that&lt;br&gt;
allows you to include, remove and update libraries within project.&lt;/p&gt;

&lt;p&gt;2) Without the .NET Framework version 4.6.2 it is not possible to use the Power Apps CLI.&lt;/p&gt;

&lt;p&gt;To install it you can either go to the &lt;em&gt;&lt;a href="https://dotnet.microsoft.com/download/dotnet-framework/net462" rel="noopener noreferrer"&gt;Microsoft website&lt;/a&gt;&lt;/em&gt; and download the Developer version. Or open Visual Studio Installer, select ‘Individual Components’ and then choose &lt;strong&gt;.NET Framework 4.6.2 SDK&lt;/strong&gt; &amp;amp; &lt;strong&gt;.NET Framework 4.6.2 Targeting Pack&lt;/strong&gt;.&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%2Fmiro.medium.com%2Fmax%2F1996%2F1%2ARzgJ14w7DHA3ZTZCcfqtpg.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%2Fmiro.medium.com%2Fmax%2F1996%2F1%2ARzgJ14w7DHA3ZTZCcfqtpg.png" alt="How to install .NET Framework 4.6.2 from VS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have selected, click on ‘Edit’ at the bottom right.&lt;/p&gt;

&lt;p&gt;3) Download the &lt;em&gt;&lt;a href="https://aka.ms/PowerAppsCLI" rel="noopener noreferrer"&gt;Power Apps CLI&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In order to create a PCF project you need to have a version of Visual Studio equal to or greater than 2017 !&lt;/p&gt;

&lt;p&gt;Once we have followed these 3 simple steps we can start setting up our project&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;How to set up a PCF project?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;1) Create a folder called MyFirstPCF&lt;/p&gt;

&lt;p&gt;2) Then, open your favorite command prompt, which can be the classic CMD or other console emulators like &lt;em&gt;&lt;a href="https://cmder.net/" rel="noopener noreferrer"&gt;CMDER&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Open the folder created, using the command ‘cd ’. It’s time to launch the command shown below:&lt;/p&gt;

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

pac pcf init --namespace &amp;lt;specify your namespace here&amp;gt; --name &amp;lt;Name of the code component&amp;gt; 
--template &amp;lt;component type&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;With this command we have created a Power Apps Component Framework (PCF) project in our folder.&lt;br&gt;
In the namespace param you can enter whatever you want, in the name param we will enter the name we want to give to our component, the important thing is to understand the types of templates available. There are currently only 2 templates for model-driven apps (&lt;strong&gt;Field&lt;/strong&gt; and &lt;strong&gt;DataSet&lt;/strong&gt;) and only one for canvas apps (&lt;strong&gt;Field&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;Since Microsoft talks about the Field in the documentation and my need was to create another type of template, a grid for example, I found myself in difficulty.&lt;/p&gt;

&lt;p&gt;So let’s choose DataSet and see what happens:&lt;/p&gt;

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

pac pcf init --namespace MyFristPCF --name GridComponent --template dataset


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

&lt;/div&gt;

&lt;p&gt;Once the command has been executed, we must make sure that we have installed all the necessary dependencies, so execute:&lt;/p&gt;

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

npm install


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

&lt;/div&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%2Fmiro.medium.com%2Fmax%2F2310%2F1%2AEHVskAjVhKQfKhKp9-SoRQ.jpeg" 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%2Fmiro.medium.com%2Fmax%2F2310%2F1%2AEHVskAjVhKQfKhKp9-SoRQ.jpeg" alt="NPM Install"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are ready to start, we have created and configured our project and our component, open component in your favourite editor. I will use Visual Studio Code.&lt;/p&gt;

&lt;p&gt;You should be able to see this files:&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%2Fmiro.medium.com%2Fmax%2F498%2F1%2A4r5Pl4A7w5zpWBw3JPgcfw.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%2Fmiro.medium.com%2Fmax%2F498%2F1%2A4r5Pl4A7w5zpWBw3JPgcfw.png" alt="Files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Creating a static grid and start it in local&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Let’s create the syle of our grid, create a folder named ‘assets’ and copy this css there:&lt;/p&gt;

&lt;p&gt;global.css&lt;/p&gt;

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

&lt;span class="nf"&gt;#customers&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Trebuchet MS"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Arial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Helvetica&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;border-collapse&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;collapse&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;#customers&lt;/span&gt; &lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;#customers&lt;/span&gt; &lt;span class="nt"&gt;th&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;#customers&lt;/span&gt; &lt;span class="nt"&gt;tr&lt;/span&gt;&lt;span class="nd"&gt;:nth-child&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;even&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f2f2f2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;#customers&lt;/span&gt; &lt;span class="nt"&gt;tr&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;#customers&lt;/span&gt; &lt;span class="nt"&gt;th&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;padding-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;left&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#4CAF50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&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;Now we need to comunicate to our PCF that the css that we want to use is the one present in global.css. To do this we will modify the &lt;strong&gt;ControlManifest.Input.xml&lt;/strong&gt;, this file is important and we will talk about it later in my next post :), for now add in the ‘resources’ tag our css reference&lt;/p&gt;

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

&lt;span class="nt"&gt;&amp;lt;css&lt;/span&gt; &lt;span class="na"&gt;path=&lt;/span&gt;&lt;span class="s"&gt;"assets/global.css"&lt;/span&gt; &lt;span class="na"&gt;order=&lt;/span&gt;&lt;span class="s"&gt;"1"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;You should have something like this:&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%2Fmiro.medium.com%2Fmax%2F3419%2F1%2AfMNXi2vHtdr8gsLcntrgJA.jpeg" 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%2Fmiro.medium.com%2Fmax%2F3419%2F1%2AfMNXi2vHtdr8gsLcntrgJA.jpeg" alt="Control Manifest"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open index.ts to write our grid code and implement it in PCF. There are some methods already presents like &lt;strong&gt;updateView&lt;/strong&gt;, &lt;strong&gt;getOutputs&lt;/strong&gt;, &lt;strong&gt;destroy&lt;/strong&gt; and &lt;strong&gt;init&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;updateView&lt;/strong&gt;: will be fired when any property of our control changes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;getOutputs&lt;/strong&gt;: called by framework when the data related to control changes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;destroy&lt;/strong&gt;: called by framework when component is removed from DOM tree&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;init&lt;/strong&gt;: initialize the control. Here you build your control with the HTML &lt;br&gt;
elements that would be rendered on CRM forms / views&lt;/p&gt;

&lt;p&gt;We want that our grid loads at the same time with the CRM page, so the code will be centralized in the &lt;strong&gt;init&lt;/strong&gt; method.&lt;/p&gt;

&lt;p&gt;Init accept in input some variables like &lt;strong&gt;context&lt;/strong&gt;, &lt;strong&gt;notifyOutputChanged&lt;/strong&gt;, &lt;strong&gt;state&lt;/strong&gt; and &lt;strong&gt;container&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;context&lt;/strong&gt;: The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to property names defined in the manifest, as well as utility functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;notifyOutputChanged&lt;/strong&gt;: A callback method to alert the framework that the control has new outputs ready to be retrieved asynchronously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;state&lt;/strong&gt;: A piece of data that persists in one session for a single user. Can be set at any point in a controls life cycle by calling ‘setControlState’ in the Mode interface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;container&lt;/strong&gt;: If a control is marked control-type=’standard’, it will receive an empty div element within which it can render its content.&lt;/p&gt;

&lt;p&gt;I will explain better the posibilities that this 4 variables are giving to us in a future post, but for now i think that we can focus on the &lt;strong&gt;container&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Let’s start code (not so much, for now :D)&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;First of all, create a container of HTMLDivElement type into our GridComponent class:&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%2Fmiro.medium.com%2Fmax%2F1893%2F1%2AERBNNxl8WLeos20U5FmRUg.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%2Fmiro.medium.com%2Fmax%2F1893%2F1%2AERBNNxl8WLeos20U5FmRUg.png" alt="Grid Component Class"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;mainContainer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;HTMLDivElement&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;I have created a simple variable named &lt;em&gt;gridHTML&lt;/em&gt; that contains our table html as bellow:&lt;/p&gt;

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

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;gridHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;table id="customers"&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;th&amp;gt;Company&amp;lt;/th&amp;gt;
&amp;lt;th&amp;gt;Contact&amp;lt;/th&amp;gt;
&amp;lt;th&amp;gt;Country&amp;lt;/th&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;Alfreds Futterkiste&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Maria Anders&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Germany&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td&amp;gt;Paris spécialités&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Marie Bertrand&amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;France&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;`&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Now, we need to create a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; to put our table in, and then ‘inject’ the HTML into the page:&lt;/p&gt;

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

&lt;span class="c1"&gt;// Create main table container div&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mainContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mainContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GridContainer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mainContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;gridHTML&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mainContainer&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Let’s see what happens, write and lunch command bellow to build and start the project in local.&lt;/p&gt;

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

npm start


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

&lt;/div&gt;

&lt;p&gt;You should be able to see the result by navigating on &lt;a href="http://127.0.0.1:8181/" rel="noopener noreferrer"&gt;http://127.0.0.1:8181/&lt;/a&gt;&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%2Fmiro.medium.com%2Fmax%2F3418%2F1%2A5n47Ec2rHDEHOpLfuVgL_A.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%2Fmiro.medium.com%2Fmax%2F3418%2F1%2A5n47Ec2rHDEHOpLfuVgL_A.png" alt="Local Debug"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, Power Apps component framework provide us a special interface of debugging, it really helps if we want to debug with real data or if we want to see if our component is responsive or not.&lt;/p&gt;

&lt;p&gt;Ok, so… I think that it’s the moment to publish this great grid :))&lt;/p&gt;

&lt;p&gt;First, navigate to our ‘GridComponent’ folder and create a new folder named ‘solution’. To publish a PCF we need a solution to connect with. Into the solution folder write the following command:&lt;/p&gt;

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

pac solution init --publisher-name &amp;lt;publisher name&amp;gt; --publisher-prefix &amp;lt;publisher prefix&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;I have created a new publisher on my environment and i will use this one, you can use yours or the default one.&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%2Fmiro.medium.com%2Fmax%2F3413%2F1%2AQS6Rm_bozuykBwdI12rHRA.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%2Fmiro.medium.com%2Fmax%2F3413%2F1%2AQS6Rm_bozuykBwdI12rHRA.png" alt="Publisher"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since my publisher name is ‘edu’ I will write something like this:&lt;/p&gt;

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

pac solution init --publisher-name edu --publisher-prefix edu


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

&lt;/div&gt;

&lt;p&gt;You will be able to see that some files were created into the folder, we have created an empty solution, now we need to connect our project to this empty solution. To do this you &lt;strong&gt;must&lt;/strong&gt; run the following command from solution path.&lt;/p&gt;

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

pac solution add-reference --path &amp;lt;project path&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;In our case, the project path is ‘ C:\MyFirstPCF’. After that we have a solution with our component inside. Next step is the connection with our organization, to do it I will use this command here:&lt;/p&gt;

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

pac auth create --url &amp;lt;your organization url&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;Before publish , we need to build it, a new folder named ‘out’ will be created in our project folder, to do it you need to be in your &lt;strong&gt;component path&lt;/strong&gt;, in this case ‘C:\MyFirstPCF\GridComponent’ and run the following:&lt;/p&gt;

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

npm run build


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

&lt;/div&gt;

&lt;p&gt;To publish our component we need to use &lt;strong&gt;Developer Command Prompt&lt;/strong&gt;, both version 2017 or 2019 are fine. This cause Power Apps CLI needs MSBuild.exe and &lt;strong&gt;Developer Command Prompt&lt;/strong&gt; already comes with it.&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%2Fmiro.medium.com%2Fmax%2F2395%2F1%2Au6Ruo-9kl-RWK_49HWlHiA.jpeg" 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%2Fmiro.medium.com%2Fmax%2F2395%2F1%2Au6Ruo-9kl-RWK_49HWlHiA.jpeg" alt="Developer Command Prompt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From our project path run bellow command:&lt;/p&gt;

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

pac pcf push --publisher-prefix &amp;lt;publisher prefix&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;And that’s it, we should be able to see our PCF published now, so navigate on our solution, entity, choose the one that you want, I will choose Account&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%2Fmiro.medium.com%2Fmax%2F2505%2F1%2A8E6whKxXoRUU_UJTlJ6c7Q.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%2Fmiro.medium.com%2Fmax%2F2505%2F1%2A8E6whKxXoRUU_UJTlJ6c7Q.png" alt="Account Entity in Default Solution"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And from ‘Controls’ tab add control like bellow:&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%2Fmiro.medium.com%2Fmax%2F1218%2F1%2AteClXb9rzVeQ_C-3G-ELTg.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%2Fmiro.medium.com%2Fmax%2F1218%2F1%2AteClXb9rzVeQ_C-3G-ELTg.png" alt="Custom Control Select"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then choose it for Web disponibility, save and publish. Let’s see what we have :)&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%2Fmiro.medium.com%2Fmax%2F3420%2F1%2A95NvPMW81lzQFuhrWJatsA.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%2Fmiro.medium.com%2Fmax%2F3420%2F1%2A95NvPMW81lzQFuhrWJatsA.png" alt="PCF Published"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have do it, I hope that this wasn’t difficult for you. I think that is enought for this post, surely I have already bored you :D&lt;/p&gt;

&lt;p&gt;I want to thank you for getting so far, this was my first article, I accept advice and I hope you enjoyed it. Next time I would like to explain better the real functionality of the PCF and how to interact with the data coming from the context, how to configure our manifest and how to debug with real data in local.&lt;/p&gt;

&lt;p&gt;See you next time !&lt;/p&gt;

</description>
      <category>pcf</category>
      <category>microsoft</category>
      <category>powerplatform</category>
      <category>microsoftpowerapps</category>
    </item>
  </channel>
</rss>
