<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Prayaag_Simform</title>
    <description>The latest articles on Forem by Prayaag_Simform (@prayaag_simform).</description>
    <link>https://forem.com/prayaag_simform</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%2F405964%2F38774086-8a15-4a55-99ed-760f96c3afbb.jpg</url>
      <title>Forem: Prayaag_Simform</title>
      <link>https://forem.com/prayaag_simform</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/prayaag_simform"/>
    <language>en</language>
    <item>
      <title>Obstacles That Make React Migration Challenging</title>
      <dc:creator>Prayaag_Simform</dc:creator>
      <pubDate>Wed, 22 Jul 2020 01:01:19 +0000</pubDate>
      <link>https://forem.com/prayaag_simform/obstacles-that-make-react-migration-challenging-836</link>
      <guid>https://forem.com/prayaag_simform/obstacles-that-make-react-migration-challenging-836</guid>
      <description>&lt;p&gt;Given the situation that you might have decided to move on from your existing tech to React, you might be in a crossroads when it comes to understanding how easy or difficult it may be to accomplish the given migration task. Enriching yourself about the challenges of React migration and its appropriate solution fixes will help you in migrating your web application entirely for continuous improvements in the best way possible. &lt;/p&gt;

&lt;h1&gt;
  
  
  1) Usage of JSX to display data
&lt;/h1&gt;

&lt;p&gt;In general, JSX provides you with a feasible capability to write simple markups in HTML. But, often with JSX, developers and project managers tend to make mistakes in binding data between the old and new web app, creating new links to necessary old URLs and so on that could have been easily avoided. &lt;/p&gt;

&lt;p&gt;The above obstacle can be resolved by writing components of React using HTML syntax. With the help of using simple curly &lt;em&gt;{}&lt;/em&gt; brackets to pass data into the elements of JSX, you can easily make the necessary variables of JSX be evaluated as a JS component. This will allow you to pass functions and evaluate React expressions and display data appropriately within any given component during the migration process.&lt;/p&gt;

&lt;h1&gt;
  
  
  2) Updating DOM with Form input
&lt;/h1&gt;

&lt;p&gt;When attempting to shift your existing web app to React, it is common to realize that with React as your frontend you should also manage the data within your old application. Using &lt;em&gt;React state&lt;/em&gt; to update the UI of your application automatically and updating the existing data using form elements to fork the existing code might not be harder than it seems. &lt;/p&gt;

&lt;p&gt;Leverage the concept of &lt;em&gt;state&lt;/em&gt; provided by React via &lt;em&gt;Hooks&lt;/em&gt; to maintain and update the UI of your web app without affecting the existing data. In other words, React state provides you with the power to create dynamic data for your web application. This will enhance the performance of your application since you will be using Hooks to update the state which in turn automatically will update the DOM. &lt;/p&gt;

&lt;h1&gt;
  
  
  3) Recreating layout with React components
&lt;/h1&gt;

&lt;p&gt;The transition between different tech stacks, libraries, and frameworks is never easy. This is because, when you are migrating your existing web app, you are not only attempting to migrate data, links, images, content, etc but rather you are also required to migrate the entire layout of your existing web app or completely revamp it. This means you have to recreate all Parent and child components as well. &lt;/p&gt;

&lt;p&gt;Use &lt;em&gt;React props&lt;/em&gt; as parameters to define the child component within every appropriate and necessary parent component. Later, provide input data through necessary React props. Along with the props, use the &lt;em&gt;StatCard&lt;/em&gt; component in order to create multiple child components. This will support all your dependencies in order to recreate the layout of your new web application. &lt;/p&gt;

&lt;p&gt;The above-mentioned walkthrough is just the tip of the iceberg. Luckily, I have written a definitive and an explained article on the steps that deal with &lt;a href="https://www.simform.com/react-migration/"&gt;how to improve the performance your web application with React Migration&lt;/a&gt;. Read to know more, it might provide you with valuable insights on saving time on migration and deployment, saving resources, and most of all keeping your React migration project within the set budget. &lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Million Dollar Question - Can React Protect Against XSS? 
</title>
      <dc:creator>Prayaag_Simform</dc:creator>
      <pubDate>Thu, 11 Jun 2020 11:28:32 +0000</pubDate>
      <link>https://forem.com/prayaag_simform/million-dollar-question-can-react-protect-against-xss-30fk</link>
      <guid>https://forem.com/prayaag_simform/million-dollar-question-can-react-protect-against-xss-30fk</guid>
      <description>&lt;p&gt;Web applications are gaining more traction every day with the increase in on-demand development for Progressive Web Applications (PWAs) and Single Page Applications (SPAs). Sure, React as a JavaScript library has always been an easy and convenient go-to library to build web applications. But, did you also know that it is not immune to security threats, especially to Cross-site scripting (XSS). &lt;/p&gt;

&lt;p&gt;If you have been using React for a while, you would know that the XSS attack in relation to React has always been a common point of discussion around several development communities. If XSS  sounds new to you, imagine it as a kind of injection attack. With this attack, perpetrators inject malicious scripts into web pages of your application at the client-side. &lt;/p&gt;

&lt;h1&gt;
  
  
  What Are The Implications of XSS?
&lt;/h1&gt;

&lt;p&gt;For starters, an XSS attack will result in a full compromise of your frontend web application. Malicious users or perpetrators will be able to track data and user paths within your application. Moreover, you will lose control over your application.&lt;/p&gt;

&lt;p&gt;In most cases, the attacker will be able to make manual requests on behalf of the application allowing them to extract any sensitive information. Sure, just like every other technology, React presents itself with facts that it comes with built-in defenses against XSS. But how far can React fight against XSS attacks? This is a million-dollar question. &lt;/p&gt;

&lt;p&gt;Having said that, let’s get to know some solutions to protect React from XSS attacks. &lt;/p&gt;

&lt;h1&gt;
  
  
  Can React Protect Against XSS?
&lt;/h1&gt;

&lt;p&gt;React has default APIs that make the application aware of the potential dangers when a new element is created within itself. When it gets notified of new elements being created or injected, it has the ability to automatically review the elements making sure it is not an XSS attack. &lt;/p&gt;

&lt;p&gt;So, what if it is an XSS attack? Surely, React just being able to automatically be aware of XSS attacks is not going to help. Fear not, React does have a defense mechanism against it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Feeding XSS Protection Through APIs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;createElement()&lt;/strong&gt; APIs come in very handy in order to provide application properties individually and manually. This helps in automatically detecting injections. Using this API element, you can create custom elements and when an attacker tries to inject and if their script value is invalid according to the API attribute you created, then your application will automatically refuse the input. &lt;/p&gt;

&lt;p&gt;But, you should note that this approach will not help if you have already lost full access and control of your application over to the attacker. &lt;/p&gt;

&lt;h2&gt;
  
  
  JSX to The Rescue
&lt;/h2&gt;

&lt;p&gt;When components of your application functions through a JSX code, the similar mechanism of custom API element creation is brought to light in providing the necessary protection. The only difference is that the protection in this case will be generated through a JSX code instead of a React API. This is possible through the auto-escaping functionality of React. It converts everything within the application into a string before rendering. &lt;/p&gt;

&lt;h2&gt;
  
  
  Is That All?
&lt;/h2&gt;

&lt;p&gt;Obviously the above two approaches are not all. There are many third-party libraries that help in protecting your application against XSS  attacks. When do you need to pick the help of third-party libraries? For instance, if you want to inject a new element into your own application in the future, your application should not consider the new element as malicious. One of the majorly preferred libraries to overcome this scenario and successfully inject your element into the code or add new elements is &lt;strong&gt;dangerouslySetInnerHTML&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JIq_MlZX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/soxvehq7d0qlz629m9ld.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JIq_MlZX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/soxvehq7d0qlz629m9ld.jpg" alt="React Security Alert"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But, don't get fooled around to think that these approaches are a workaround to completely protect React against XSS. In addition to that, did you consider that there might be more security threats like XSS to a React web application? What if the attacks are injected through HTTP headers? URLs? Authentication failures? The list goes on and on! Beware of some vulnerabilities that might expose your web application to some security-related threats. I have written a whole blog covering all these pitfalls with their solutions: &lt;a href="https://www.simform.com/react-security-vulnerabilities-solutions/"&gt;React security vulnerabilities&lt;/a&gt;. It might very well come in handy just to be aware of the security obstacles that exist around React and its solutions. &lt;/p&gt;

</description>
      <category>react</category>
      <category>security</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
