<?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: Titouan Sola</title>
    <description>The latest articles on DEV Community by Titouan Sola (@titouansola).</description>
    <link>https://dev.to/titouansola</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%2F247217%2F3a564f1c-e29d-47d3-be92-713eb15bff90.jpeg</url>
      <title>DEV Community: Titouan Sola</title>
      <link>https://dev.to/titouansola</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/titouansola"/>
    <language>en</language>
    <item>
      <title>I tried Svelte</title>
      <dc:creator>Titouan Sola</dc:creator>
      <pubDate>Sat, 30 May 2020 10:15:44 +0000</pubDate>
      <link>https://dev.to/titouansola/i-tried-svelte-25em</link>
      <guid>https://dev.to/titouansola/i-tried-svelte-25em</guid>
      <description>&lt;p&gt;Welcome to the first article of a series I named "I tried ..."!&lt;br&gt;
My purpose here is to manipulate multiple technologies (new or older) and give my opinion over it! I'll try to write in a small amount of time, so I won't loose it procrastinating! Thank you for reading, let's go! ;)&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Svelte ?
&lt;/h2&gt;

&lt;p&gt;Svelte is a component oriented framework for the web, helping you building reactive applications. It introduces a new file extension &lt;code&gt;.svelte&lt;/code&gt; as it brings its own compiler. According to &lt;a href="https://svelte.dev"&gt;Svelte landing page&lt;/a&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Whereas traditional frameworks like React and Vue do the bulk of their work in the browser, Svelte shifts that work into a compile step that happens when you build your app.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So it remains fast in the browser (and we like it).&lt;/p&gt;
&lt;h4&gt;
  
  
  Write components
&lt;/h4&gt;

&lt;p&gt;To write Svelte components, you'll have to mix JavaScript, CSS and HTML within the same &lt;code&gt;.svelte&lt;/code&gt; file using tags. This singular approach looks like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Hello World!&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    count : { count }
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;on:click=&lt;/span&gt;&lt;span class="s"&gt;{increment}&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Increment&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;p&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;blue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can see in this short example, you don't have to manipulate DOM element with JavaScript, but write some kind of JSX like you will do with React, as it's really close to HTML syntax &lt;strong&gt;but&lt;/strong&gt; mixed up with JavaScript inside, using brackets.&lt;/p&gt;

&lt;h4&gt;
  
  
  Directives
&lt;/h4&gt;

&lt;p&gt;Pay attention to the way we implemented mouse click event handler. The &lt;code&gt;on:eventName&lt;/code&gt; directive is here to tell Svelte you want to run a function when event 'eventName' is triggered. Svelte lets you the flexibility to create your own events with &lt;code&gt;createEventDispatcher&lt;/code&gt; API, so you're not constraint by native ones.&lt;/p&gt;

&lt;p&gt;There are several useful directives like this one. Most used will be &lt;code&gt;bind:something&lt;/code&gt; of course, as it lets you bind variables you declared in your component script, so you can make re-render the element on changes (like &lt;code&gt;&amp;lt;input bind:value={value} /&amp;gt;&lt;/code&gt;).&lt;/p&gt;

&lt;h4&gt;
  
  
  Component life cycle
&lt;/h4&gt;

&lt;p&gt;All component oriented frameworks come with utilities to manage components life cycle, and Svelte is no exception! There are four : onMount, onDestroy, beforeUpdate and afterUpdate. Just read their names to understand what they do! You just have to provide them a callback, and they will execute it during the right cycle.&lt;/p&gt;

&lt;h4&gt;
  
  
  State management
&lt;/h4&gt;

&lt;p&gt;In case you want to build a store to manage your application states properly (as you'd do with Redux, RxJS, MobX or whatsoever) Svelte provides a full utility tools panel! Don't need to smash another external library, just focus on your code!&lt;br&gt;
You are able to create two kind of stores : writable or readable.&lt;br&gt;
The main difference is that writable are mutable by 'outside' using their &lt;code&gt;set&lt;/code&gt; method. To get their value, you'll have to subscribe to them, then unsubscribe (same thing with readable stores, of course) :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;writable&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;svelte/store&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;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;writable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Subscribed!&lt;/span&gt;&lt;span class="dl"&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;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Unsubscribed!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;unsubscribe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// logs '0'&lt;/span&gt;

&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// logs '1'&lt;/span&gt;

&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// logs '2'&lt;/span&gt;

&lt;span class="nx"&gt;unsubscribe&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Nothing new for you if you're used to observable!&lt;/p&gt;

&lt;h2&gt;
  
  
  Things I liked about it
&lt;/h2&gt;

&lt;p&gt;There are so much things I love with Svelte, I don't know where to begin!&lt;br&gt;
Svelte file structure is probably the solution I expected for my frustration using React or Angular. None of this two fully satisfies me on component construction (structure, style and behavior).&lt;br&gt;
Here, I have the power to assemble every part of a component in a single file, with no harm to keep control over them.&lt;/p&gt;

&lt;p&gt;I also really like state management simplicity, I found it really understandable, no black magic behind.&lt;/p&gt;

&lt;p&gt;If you read my article &lt;a href="https://dev.to/titouansola/a-quick-comparison-react-angular-2mk2"&gt;'A quick comparison: React / Angular'&lt;/a&gt; you may have noticed that Svelte is in top position of smallest bundle size, where React, Angular and even Vue are way behind (from 4 to 20 times heavier!). As developers, we should always worried about this, as it will impact final users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things I did not like about it
&lt;/h2&gt;

&lt;p&gt;Actually, there is no really aspect of Svelte that I really disagree with, but I found points that can be improve to make him &lt;strong&gt;the best framework&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Whether hot-reload is available with Svelte compiler, I found some weird behaviors sometimes, I had to destroy the entire bundle, and recompile everything again to see my changes be effective, &lt;strong&gt;but&lt;/strong&gt; it was rare.&lt;/p&gt;

&lt;p&gt;Svelte community is great, and even if they are working on their communication over job opportunities, the industry is slow, and jobs evolution still push same tools (React, Angular, Java SpringBoot, .Net...). I hope in the future that we'll see more Svelte jobs opportunities ! If you're looking for one, you can follow &lt;a href="https://twitter.com/sveltejobs"&gt;this Twitter account&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Svelte is a wonderful framework, full of potential, and I'll be watching really close its development. Concurrency is rude, but I think Svelte has everything to raise in the top web-client frameworks of this decade.&lt;br&gt;
Even more when you know all the ecosystem dev team is building around it!&lt;/p&gt;

&lt;p&gt;If you want to learn more about Svelte, check their &lt;a href="https://svelte.dev/docs"&gt;documentation&lt;/a&gt; and start a little project to make your own opinion!&lt;/p&gt;

&lt;p&gt;That's all folks! Hope you liked it! Stay safe, drink water, and happy hacking!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You made NO joke really ?&lt;/em&gt;&lt;br&gt;
Sorry no time catch up later bye ++ ciao&lt;br&gt;
&lt;em&gt;Am I a joke to you ?&lt;/em&gt;&lt;br&gt;
:)&lt;/p&gt;

&lt;h2&gt;
  
  
  About the author
&lt;/h2&gt;

&lt;p&gt;Follow me on my socials!&lt;br&gt;
Twitter : &lt;a href="https://twitter.com/TitouanSola"&gt;https://twitter.com/TitouanSola&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Devto : &lt;a href="https://dev.to/titouansola"&gt;https://dev.to/titouansola&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Website: &lt;a href="https://titouansola.dev"&gt;https://titouansola.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>A quick comparison: React / Angular</title>
      <dc:creator>Titouan Sola</dc:creator>
      <pubDate>Thu, 14 May 2020 13:31:46 +0000</pubDate>
      <link>https://dev.to/titouansola/a-quick-comparison-react-angular-2mk2</link>
      <guid>https://dev.to/titouansola/a-quick-comparison-react-angular-2mk2</guid>
      <description>&lt;p&gt;Yes, I know, this topic has been debated many times, and will be, for so long. I'm not the first to try to explain differences between those well known entities, and neither the last. My purpose here is to bring my vision over it, and give comparison methodologies to new developers, such as students, interns or juniors.&lt;/p&gt;

&lt;p&gt;Well, let's get into it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Philosophies
&lt;/h2&gt;

&lt;p&gt;There's no tool in this world which serve no purpose. &lt;strong&gt;Especially&lt;/strong&gt; in tech industry! Currently, developers never used as many tools as before (and maybe a return of minimalism because of it) and choosing them hasn't been this difficult over the past years. Out of this frameworks ocean, there are two (three actually) of them which have demonstrated their efficiency : ReactJS, and Angular &lt;em&gt;(and Vue.js but I won't talk about it as I don't know it well)&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  React
&lt;/h4&gt;

&lt;p&gt;According to React &lt;a href="https://reactjs.org" rel="noopener noreferrer"&gt;landing page&lt;/a&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"React is a JavaScript library for building user interfaces."&lt;/p&gt;

&lt;p&gt;"React makes it painless to create interactive UIs."&lt;/p&gt;

&lt;p&gt;"Declarative views make your code more predictable and easier to debug."&lt;/p&gt;

&lt;p&gt;"We don’t make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It was published for the first time in 2013 by Facebook. Jordan Walke, his father, was influenced by XHP, a PHP library based on HTML component which was also developed by Facebook, released by 2010.&lt;br&gt;
The major innovation was the implementation of JSX (JavaScript XML) as an extension to JavaScript.&lt;br&gt;
JSX gives the ability to declare HTML tags as JavaScript variables, and use scripts inside the XML architecture.&lt;br&gt;
As it probably seems a little blurry, I will give you an example :&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;class&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;render&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;meal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pasta&lt;/span&gt;&lt;span class="dl"&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;(&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;The best meal in the universe is &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;meal&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;. No doubt.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Angular
&lt;/h4&gt;

&lt;p&gt;According to Angular &lt;a href="https://angular.io" rel="noopener noreferrer"&gt;landing page&lt;/a&gt; :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"One framework. Mobile &amp;amp; desktop."&lt;/p&gt;

&lt;p&gt;"Learn one way to build applications with Angular and reuse your code and abilities to build apps for any deployment target."&lt;/p&gt;

&lt;p&gt;"Build features quickly with simple, declarative templates."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Angular (known today as Angular 2+) is a rewrite of AngularJS. from JavaScript to TypeScript, leaving behind jQuery, Angular is quite different from its 2009 predecessor, and will be published only in 2016. As the new version is pretty young, many companies haven't made the upgrade yet, and you can still find jobs using it.&lt;/p&gt;

&lt;p&gt;So, Angular is a framework based on TypeScript, providing now a multitude of core APIs, as it's meant to be used (almost) alone for building client side application. It uses MVC pattern, as you write HTML template and a controller for each of your components, and declare data model with the help of RxJS.&lt;/p&gt;

&lt;p&gt;Now that we know the different philosophies, it's time to code! Let's see how we build a minimal application with both frameworks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hello World!
&lt;/h2&gt;

&lt;p&gt;If it's your first time with these two, be sure to have Node.js installed on your computer!&lt;/p&gt;

&lt;h3&gt;
  
  
  React
&lt;/h3&gt;

&lt;p&gt;React needs only two dependencies, you can install them with this command :&lt;br&gt;
&lt;code&gt;npm install react react-dom --save&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We'll start with a simple HTML file :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Hello World!&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"index.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;next to it, create an index.js file, which contains :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&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 World!
             &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="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;App&lt;/span&gt;&lt;span class="p"&gt;/&amp;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;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What's happening here ? Once the script is injected, all the magic is in this call :&lt;br&gt;
&lt;code&gt;ReactDOM.render(&amp;lt;App/&amp;gt;, document.getElementById('root'));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We are rendering a React element into the DOM. The container 'root' is selected through &lt;code&gt;document&lt;/code&gt;, the JavaScript object representing the DOM.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Is it that simple ?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Yes! Now we want to see our app, we need to bundle and serve it. You can use &lt;a href="https://parceljs.org" rel="noopener noreferrer"&gt;Parcel&lt;/a&gt; for this purpose :&lt;br&gt;
&lt;code&gt;npm install parcel-bundler --save-dev&lt;/code&gt;&lt;br&gt;
Then :&lt;br&gt;
&lt;code&gt;parcel index.html&lt;/code&gt;&lt;br&gt;
Open a browser and go to localhost:1234, you must see your app saying &lt;em&gt;'Hello World!'&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Angular
&lt;/h3&gt;

&lt;p&gt;Angular requires to use a CLI to build yourself a usable project, I recommend you to install it globally :&lt;br&gt;
&lt;code&gt;npm install -g @angular/cli&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then, we will initiate our project with :&lt;br&gt;
&lt;code&gt;ng new my-angular-app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now you have a whole project ready to run with &lt;code&gt;npm start&lt;/code&gt;.&lt;br&gt;
In a way to render 'Hello World!', I invite you to just write this in &lt;code&gt;src/app/app.component.html&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Hello World!&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open a browser, and go to localhost:4200.&lt;/p&gt;

&lt;p&gt;So, as you can see in your index.html, there's a strange tag in your body : &lt;code&gt;&amp;lt;app-root&amp;gt;&amp;lt;/app-root&amp;gt;&lt;/code&gt;. In fact, this tag refers to your component selector, as you can see in &lt;code&gt;src/app/app.component.ts&lt;/code&gt;, as a parameter of &lt;code&gt;Component&lt;/code&gt; decorator. The mechanic of component encapsulation is base on referring to a selector as a tag, in your templates.&lt;/p&gt;

&lt;p&gt;Well, although it seems more complicated to use Angular, actually the CLI brings useful features, like component, module or directive generation. React may be only a library, &lt;code&gt;create-react-app&lt;/code&gt; is a useful CLI package to quickly build a React project, you should give it a try if you're a beginner!&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  React
&lt;/h3&gt;

&lt;p&gt;According to React paradigm, there's no mandatory architecture! It gives you freedom of settling your folders the way you want, or adapted them to a specific use case. Besides, I advise you to separate wisely your different types of file, like services / components / containers / pages...&lt;br&gt;
If you're a Yarn user, don't hesitate to use packages!&lt;/p&gt;

&lt;h3&gt;
  
  
  Angular
&lt;/h3&gt;

&lt;p&gt;Previously, when we used the &lt;code&gt;ng new&lt;/code&gt; command to create a workspace. As it's described in this &lt;a href="https://angular.io/guide/file-structure" rel="noopener noreferrer"&gt;guide&lt;/a&gt;, workspaces may contain multiple projects, but by default, the 'new' command generate also an application, which follows a specific structure.&lt;/p&gt;

&lt;p&gt;But there's a hint. Angular CLI offers you the ability to generate components, and create for you a folder with 4 files inside :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A TypeScript file, which is your component controller;&lt;/li&gt;
&lt;li&gt;An HTML file, which is your component template;&lt;/li&gt;
&lt;li&gt;A style file (CSS/SASS/SCSS, whether which one you have chosen);&lt;/li&gt;
&lt;li&gt;An other TypeScript file (ending in spec.ts) which is a testing file for your component.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This folder is created in your &lt;code&gt;src/app&lt;/code&gt; directory, as the 'root' directory for Angular components. Whether it seems to be enjoyable using such commands, what happens in a real world project, with twenty, fifty, a hundred components, services, models... ?&lt;br&gt;
Thankfully, you can provide a path to your component when you're naming it, by adding slashes. For example, &lt;code&gt;ng g c components/todo/todo-list&lt;/code&gt; will create a folder &lt;code&gt;todo-list&lt;/code&gt; in &lt;code&gt;src/app/components/todo&lt;/code&gt;. as I told you, &lt;code&gt;src/app&lt;/code&gt; will be the 'root', so it's up to you to arrange your directories the way you want!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What's the point of this section then ?&lt;/em&gt;&lt;br&gt;
To show you that both frameworks let you organize your project the way you want, at the exception that Angular provide a quicker way to add and import a component to your codebase, but you have to tell him where you want to generate it, and it makes your &lt;code&gt;app.module.ts&lt;/code&gt; bigger and bigger over time...&lt;/p&gt;

&lt;h2&gt;
  
  
  Bundle size
&lt;/h2&gt;

&lt;p&gt;When your project has to be the tiniest, the choice between the technologies you will be using is really important, as they don't bundle their sources the same weight. Many studies confronted the most popular frameworks on their bundle size for a comparable 'real world' project. That being said, with the earliest version of Angular and React, numbers changed a bit, but you can be assured that rankings stayed quite in place.&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://www.freecodecamp.org/news/a-realworld-comparison-of-front-end-frameworks-with-benchmarks-2019-update-4be0d3c78075/" rel="noopener noreferrer"&gt;this article&lt;/a&gt; from freecodecamp, there are thee result for frameworks bundle sizes, in kB :&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-media-1.freecodecamp.org%2Fimages%2FDRmH8Fz15DLxXguz9d8NR0eVanX0U9xW9jom" 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%2Fcdn-media-1.freecodecamp.org%2Fimages%2FDRmH8Fz15DLxXguz9d8NR0eVanX0U9xW9jom" alt="Frameworks bundle sizes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Wait... Why React and Angular appear multiple time ?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Because in a real world project, you will probably not use Angular neither React alone, so it's important to mention the most used side kicks!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Like Robin for Batman ?&lt;/em&gt;&lt;br&gt;
Absolutely!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ok but what this chart tells us ?&lt;/em&gt;&lt;br&gt;
Basically, React has the potential to be lighter than Angular, depending on the dependencies you choose.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Depending on the dependencies ?&lt;/em&gt;&lt;br&gt;
Isn't that poetic ?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Not really.&lt;/em&gt;&lt;br&gt;
I hate you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrated APIs
&lt;/h2&gt;

&lt;p&gt;By definition, each framework comes with many utilities that make them autonomous, or not. Let's see what tools React and Angular provide!&lt;/p&gt;

&lt;h3&gt;
  
  
  React
&lt;/h3&gt;

&lt;p&gt;Besides make DOM manipulations easier, there's no other features React gives to us. That being said, after version 16, and the apparition of Hooks, the community raised new functionalities very useful and time saving. But is that really 'React' ? Well, as the project is open source, and considering it is only a library (so not &lt;em&gt;reeeeeally&lt;/em&gt; a framework), we can consider at least those new packages are come from the 'React Universe' as Hooks is a specific to React. I'm tempted to say that this extended universe &lt;strong&gt;is&lt;/strong&gt; the real React, but it's just my opinion!&lt;/p&gt;

&lt;h3&gt;
  
  
  Angular
&lt;/h3&gt;

&lt;p&gt;HTTP requests, Forms, animations... Angular is full of services, sometimes easy to use, sometimes... Well, I'm not giving my view on this right now! But it is certain that Angular stands by itself, and can be used relatively quickly, with unique documentation.&lt;/p&gt;

&lt;p&gt;What's important to know here is that if you choose React, you will have to find other libraries to build your features, but there are plenty wonderful packages out there so it won't be a problem if you like them. In the other, Angular is provided with almost every tools you need, but you have to get used with Angular documentation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;So you're saying Angular doc is awful ?&lt;/em&gt;&lt;br&gt;
No, just saying you have to get used with it. No opinion here!&lt;/p&gt;

&lt;h2&gt;
  
  
  Community and job opportunities
&lt;/h2&gt;

&lt;p&gt;Here again, I will need charts, and what can be better than StackOverflow to provide them ?&lt;/p&gt;

&lt;p&gt;StackOverflow made a survey early 2019, and near 90 000 software developers answered! Find all the results &lt;a href="https://insights.stackoverflow.com/survey/2019" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's focus first on developers feelings, by observing the &lt;em&gt;'Most Loved Web Frameworks'&lt;/em&gt; charts :&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FgjpKs1j8%2FIMAGE-BLOG.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%2Fi.postimg.cc%2FgjpKs1j8%2FIMAGE-BLOG.png" alt="Most loved framework"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Near 20% space between React and the pair Angular/Angular.js, that's quite impressive. But, we have to put back in context. If Angular was coupled with Angular.js, it may explain those numbers. See, the first version of the framework is in decline for many years, and most of developers do not want to touch it again. Version 2 is very young, so there's still a big part of developers who work with Angular.js, because their project hasn't made the switch. I think Angular might be at least à 60-65% on this chart if it would be on its one, but I'm not convinced it can reach React.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;And that, again, it's your opinion.&lt;/em&gt;&lt;br&gt;
I'm aware of that, Mr. Im-always-against-you!&lt;/p&gt;

&lt;p&gt;Focusing on the job offers, this &lt;a href="https://medium.com/zerotomastery/tech-trends-showdown-react-vs-angular-vs-vue-61ffaf1d8706" rel="noopener noreferrer"&gt;article&lt;/a&gt; summed up in a chart gathering the most popular job board on  the internet :&lt;br&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%2F1264%2F1%2Aa8ANIeKV-H8uTXaXOcfPEQ.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%2F1264%2F1%2Aa8ANIeKV-H8uTXaXOcfPEQ.png" alt="Job offers in tech"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Angular: Red / React: Blue / Vue.js: Green)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This one gives confidence in Angular developers! Yes there are jobs for you! As you can see, both offer quite the same amount of jobs around the globe, and are really far away from their third concurrent, Vue.js.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;So who wins ?&lt;/em&gt;&lt;br&gt;
Nobody wins, cause it's not a fight!&lt;/p&gt;

&lt;p&gt;After this cheesy pre-conclusion, you probably want me to give my verdict. But first, I want &lt;strong&gt;you&lt;/strong&gt;, student, young developer, to know that the best technologies in the world are the technologies &lt;strong&gt;you&lt;/strong&gt; are the most comfortable with. You will never build your entire career on only one framework, neither one language. You must make your own opinion over new released technology by trying them! This is how you will slowly become a confirmed developer.&lt;/p&gt;

&lt;h3&gt;
  
  
  My point of view
&lt;/h3&gt;

&lt;p&gt;I am a React lover. I admit that if I had to choose, I'll go React every time. Because React fits me very well, even more now, with the Hooks. The feelings I got by coding with this library have no equivalent. But, I'll not throw Angular to trash. In my opinion, Angular is a good choice for two use cases :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You're a student, you never built a web application before, you barely know your basics on HTML CSS and JS, Angular is a perfect choice for you to enter this world.&lt;/li&gt;
&lt;li&gt;You're a big company, you have big and strong process, Angular will help you to maintain your structure.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The reason I don't particularly like Angular, is because of its documentation, and sometimes, the difficulty to implement what I found really basic with React (like forms). To be honest, React documentation is not the best, but it does the job.&lt;/p&gt;

&lt;p&gt;That's it for me! I hope you enjoyed reading this article, it's my first time as a tech comparator. Don't hesitate to &lt;em&gt;nicely&lt;/em&gt; comment which one you prefer between both frameworks, or give me the ones you want me to talk about!&lt;/p&gt;

&lt;p&gt;Stay safe, drink water, and happy hacking!&lt;/p&gt;

</description>
      <category>react</category>
      <category>angular</category>
    </item>
    <item>
      <title>How to rock your computer science internship</title>
      <dc:creator>Titouan Sola</dc:creator>
      <pubDate>Sat, 09 May 2020 08:43:16 +0000</pubDate>
      <link>https://dev.to/titouansola/how-to-rock-your-computer-science-internship-ihj</link>
      <guid>https://dev.to/titouansola/how-to-rock-your-computer-science-internship-ihj</guid>
      <description>&lt;p&gt;Internships are great first footsteps in the industry, after have been sitting to class, exams, student projects.&lt;br&gt;
Even if teachers tried to explain you the basics of corporate life (which is by the way, an &lt;em&gt;'How to live in society'&lt;/em&gt; like), you are feared by the unknown, as you have probably never been into those kind of strange places named &lt;strong&gt;opened space&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I graduated last year (2019) from an engineering school, after spent my two internships in a startup from South of France. Since, I've worked for few clients, and I have now the fresh experience in mind to tell you, students, how to rock an internship, and what to expect from this world.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Motivation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PWFIwRie--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1494959764136-6be9eb3c261e%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D3300%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PWFIwRie--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1494959764136-6be9eb3c261e%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D3300%26q%3D80" alt="Motivation"&gt;&lt;/a&gt;&lt;br&gt;
Nothing comes without motivation. You are the only one who could make knowledge flowing into your head. Nobody can do it for you. You, and only you, have the responsibilities for your progression, whether at school, work and even in life. So the first question you have to ask to yourself is :&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Do I really want to step up ?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If the answer is no, you can close this tab, and let your boss using your time to do boring stuff.&lt;/p&gt;

&lt;p&gt;If the answer is yes, get prepared to overcome your own abilities, and be boosted by positive energy! You don't 'solve problems', you come with solutions. You don't fail, you're learning. You don't 'ask for help', you need experience, knowledge, you're no more a student, you're an engineer.&lt;/p&gt;

&lt;p&gt;Have you ever wonder what it feels like to build a tool people &lt;strong&gt;actually&lt;/strong&gt; use ? You should be excited by this idea :&lt;br&gt;
Somebody out there, will get to his device, open a new tab, write something in Google, get redirected to an interface, and start using features &lt;strong&gt;you&lt;/strong&gt; implemented. You have to feel the enjoyment of the user, to be in his head, at every moment of his passage through your tool. You should ask yourself : Why does  he clicks on this button ? How many steps does it requires to do &lt;em&gt;this&lt;/em&gt; action ? Is it a pain to achieve that ?&lt;/p&gt;

&lt;p&gt;You won't always be guided by an UX/UI design team who answer these questions before, sometimes, you will have to take a step back of what you're doing, and think about it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How I'm supposed to anticipate the user behaviour ?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;OK, I see you want some &lt;strong&gt;concrete&lt;/strong&gt; actions to do, first day.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Learn to learn
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DuLPN8IP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1531403009284-440f080d1e12%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D2100%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DuLPN8IP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1531403009284-440f080d1e12%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D2100%26q%3D80" alt="Learn to learn"&gt;&lt;/a&gt;&lt;br&gt;
On your first day, &lt;strong&gt;be on time&lt;/strong&gt;, and let your tutor guide you. You may receive a professional computer, or any stuff required to your job. If you don't already know the job they gave to you, they will finally talk about it. Be aware, this is the moment you have to be really focus. Capture &lt;strong&gt;any&lt;/strong&gt; details. And, please,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TAKE NOTES.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WITH A PEN.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Write down the five W :&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Who&lt;/strong&gt; are the stakeholders ?
&lt;/h4&gt;

&lt;p&gt;Every person or entities around the project. From users to developers, subcontractors, project manager, VCs...&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;What&lt;/strong&gt; is the project ?
&lt;/h4&gt;

&lt;p&gt;Is that a web application ? A software ? A plugin ? A bread toaster ? Which technologies are required ?&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Where&lt;/strong&gt; will it be used ?
&lt;/h4&gt;

&lt;p&gt;Think about context here, and what it implies to your tool. At home (Understand probably peaceful environment) ? At a restaurant (No computer then, think mobile, lightness, smooth) ? At a party (Fun, network, jokes...) ? At work (performance, resilience, speed...) ?&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;When&lt;/strong&gt; will it be release ?
&lt;/h4&gt;

&lt;p&gt;Time is important, you can easily measure the scope size by the time planned to work on it. Years projects are mostly to become business software, whereas 1-2 months might be just a quick use tool, implemented over another software (like a plugin).&lt;/p&gt;

&lt;h4&gt;
  
  
  And finally, most important, &lt;strong&gt;why&lt;/strong&gt; is this project alive ?
&lt;/h4&gt;

&lt;p&gt;This is where you have to know every details. &lt;strong&gt;Why ?&lt;/strong&gt; Why do anybody need this tool ? Why will they choose this over that ?&lt;/p&gt;

&lt;p&gt;Once you are able to answer those questions, it's time to open yourself to your new environment. I hope your manager will present to you the team, their job, they are your main assets during this journey.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What about me ?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You don't know yet what you have to do ? Ask your manager ! You need access to code repository ? Ask your lead developer ! You are hungry ? Why didn't you eat this morning ?&lt;/p&gt;

&lt;h2&gt;
  
  
  3. From tests to complete feature
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iT7xu-aN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1522071820081-009f0129c71c%3Fixlib%3Drb-1.2.1%26auto%3Dformat%26fit%3Dcrop%26w%3D2100%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iT7xu-aN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1522071820081-009f0129c71c%3Fixlib%3Drb-1.2.1%26auto%3Dformat%26fit%3Dcrop%26w%3D2100%26q%3D80" alt="My job, according to my company"&gt;&lt;/a&gt;&lt;br&gt;
Don't expect your internship mission to be &lt;em&gt;'Land this rocket on the Moon'&lt;/em&gt;. First, because you're not at NASA (And if you are, why are you even reading this ?) and second, because your company knows you're just a student. They don't want you to be a senior developer, they want you to dive into their process, and shape your mind for their needs. If you provide a good value, they'll give you a job, because they don't want raising talents for their concurrents.&lt;/p&gt;

&lt;p&gt;In this context, there's 2 possibilities :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;You applied to a startup, and they'll probably give you some small responsibilities, so they can scale over you. Not a bad thing if you're a hard worker, and like learning things by yourself. You may be ending your period being an essential piece of the system. As startups needs to grow fast, with few incomes, don't expect a big salary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You applied to big company, and you will be running tests. At least at beginning. It's now in your hand to show what you are capable of, and free yourself, to finally have rights to push your first merge request. Understand that you will not have any responsibilities, as projects cost millions of dollars (I don't overestimate this), and will certainly not bet on you.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2 bis. You applied to big company, &lt;strong&gt;but&lt;/strong&gt; they placed you on a 'dedicated to interns' project. Those projects are sold for a minimal budget to clients, as they accept it will be run (almost) only by juniors. In this particular case, you will feel like in a startup environment, but with larger process, and much more people. If you are here, refer to case #1, more then #2.&lt;/p&gt;

&lt;p&gt;As you imagine, both cases have their ups and downs. Inertia of big companies leads to employees often formatted by process, but knowing where they have to go. Startups philosophy is driven by their values, more than academic consensual rules.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Personal thoughts over this choice&lt;/em&gt;&lt;br&gt;
In my opinion, I'll choose startups if I need better/new skills, and big structures if I want to build a career path, especially if I wanted to divorce with tech, and go to management, commercial, human resources...&lt;/p&gt;

&lt;p&gt;So, basically, if you're stuck into tests running, don't panic, and show you can code.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I want to do it, but they won't let me, what shall I do ?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Make &lt;strong&gt;suggestions&lt;/strong&gt;. Propose some improvements where you think it will be good. By making those tests, you'll start to know, step by step, the entire codebase, how parts are related, and then you'll be able to propose yourself to write code, even if it's just refactoring it. By refactoring, your colleagues will see you can handle complexity, until finally, build your first feature. Don't forget to use the same methodologies as you commit your code!&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Make mistakes, ask for help
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---53UwYPV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1508935662753-629c6fae16e9%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D2100%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---53UwYPV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1508935662753-629c6fae16e9%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D2100%26q%3D80" alt="Make mistakes"&gt;&lt;/a&gt;&lt;br&gt;
Of course, not on purpose! You will make mistakes by trying new concepts, then fix it. I always keep this phrase in my head when I start a new project :&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A mistake once is finding out, twice is improvement, there's no third.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is 'learning by failure', and it's not a bad thing. It will show to your superiors your abilities to memorize, and keep a progression.&lt;/p&gt;

&lt;p&gt;Again, don't forget to &lt;strong&gt;take notes&lt;/strong&gt;. Write down every issues you have faced, and how you resolved it. If you encounter it again, you have the knowledge to overcome. In the end, your head will be full of tricks, that make you a better developer.&lt;/p&gt;

&lt;p&gt;Sometimes, an issue is too complicated for you. And it's ok, you are not supposed to know everything! Ask for help. But first, have you tried to Google it ? There are several rules you should respect in order to make a good request to a senior. When you're facing a bug :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Log everything you can to spot the error (or use a debugger)&lt;/li&gt;
&lt;li&gt;Google it if you don't understand it&lt;/li&gt;
&lt;li&gt;Do &lt;strong&gt;not&lt;/strong&gt; copy paste anything from Stack Overflow, &lt;strong&gt;PLEASE&lt;/strong&gt;, it shows.&lt;/li&gt;
&lt;li&gt;Ask your siblings (another intern, or a junior dev) &lt;em&gt;Have you experienced this error before ? Is it project specific ?&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Ask to a senior, and tell him/her you have done those steps. They hate to be disturb by a guy who can't Google something, like everybody else.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some manager ask, during a daily meeting, for any issues blocking your progression. Do not wait for daily meeting to talk about it! You can't spend a day &lt;em&gt;just waiting&lt;/em&gt; because you're stuck, you are waisting time, money and energy (managers don't like it, and honestly, who can blame them ?). In a contrary, tell them you've faced it, and resolved it, or that you have solutions in mind to try before declaring you stuck.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Don't worry, even if I portrayed a kind of dark world, &lt;strong&gt;companies don't make people, people make companies&lt;/strong&gt;. People with fears, expectations, insecurities, rules, just like you. You will not become a "2.0 slave". You ever have freedom to quit your job if you don't feel well about it, and opportunities to grow up, just the way you want. There's a plenty of really great companies out there, you just have to find the one which fits you the most. And if you don't have corporate mind, go freelance like me! Maybe I'll write another article on that topic.&lt;/p&gt;

&lt;p&gt;Concerning your expectations, yes you will learn things, and probably much more than during your scholarship. Just because you won't become a great baker by watching YouTube tutorials. Talk to people, learn their story, their universe, and build yourself a network.&lt;/p&gt;

&lt;p&gt;I hope you know now how to prepare yourself to beat this like a rockstar, because this is what I want you to be! Yeah!&lt;/p&gt;

&lt;p&gt;Stay safe folks, hydrate yourself, and happy coding!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uXJArdin--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1452697620382-f6543ead73b5%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D2100%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uXJArdin--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1452697620382-f6543ead73b5%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D2100%26q%3D80" alt="Happiness"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>internship</category>
    </item>
    <item>
      <title>React Style : 4 ways to apply style to components</title>
      <dc:creator>Titouan Sola</dc:creator>
      <pubDate>Sat, 02 May 2020 17:38:06 +0000</pubDate>
      <link>https://dev.to/titouansola/react-style-4-ways-to-apply-style-to-components-579l</link>
      <guid>https://dev.to/titouansola/react-style-4-ways-to-apply-style-to-components-579l</guid>
      <description>&lt;h1&gt;
  
  
  What's the matter with styling React components ?
&lt;/h1&gt;

&lt;p&gt;React, as you may already know, is a JavaScript library used to build complex web applications by a component architecture. Its paradigm is to provide a total freedom of structure, without requirement nor unique way to achieve something.&lt;/p&gt;

&lt;p&gt;Beside this liberty, React offers a wide land of potential mistakes and hard to maintain features if you let yourself fall into laziness of non-testing your code, don't clarify your own folders, or miss opportunities to write reusable code.&lt;/p&gt;

&lt;p&gt;And then comes style. Some coders like me use to have nightmares just thinking of CSS, and sadly, React don't show up with a dedicated solution. Well, in fact, there's one, and we will find out!&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic styling with React
&lt;/h2&gt;

&lt;p&gt;If you ain't new to React, you're probably used to style components like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="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;Pastas&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="na"&gt;style=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yellow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;marginLeft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Best meal ever. Don't @ me.
    &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;And you are not wrong! This is the way React gives us to style component. And now, you may have so much questions like : &lt;em&gt;'Okay but how about conditional style like mouse hover or focus ?' 'Should I really use magic numbers EVERYWHERE ?' 'What sauce does he use with his pastas ?'&lt;/em&gt;&lt;br&gt;
And I can't blame you for that, because, it's not possible, without escaping good ol CSS. You just have to pass a POJO to the &lt;code&gt;style&lt;/code&gt; property of any HTML tag, React applies it (kind of magic isn't it ?)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Can you get to your point ?&lt;/em&gt;&lt;br&gt;
YES i'll do it.&lt;/p&gt;

&lt;p&gt;As React lets you to use any package through the Node universe, I identified for you 4 ways to style properly your components, with reusable, customizable and clean code.&lt;/p&gt;
&lt;h1&gt;
  
  
  The 4 ways to the apocalypse
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;(because you rock)&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Pretending to be Angular
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Oh really ? Why not using Angular then ?&lt;/em&gt;&lt;br&gt;
That's an other subject, I may discuss within an other article! But for now, it's time to benchmark!&lt;/p&gt;

&lt;p&gt;Angular 2+ creates a shadow DOM for every nodes within its structure, so you'll be able to style your component one by one, using a CSS / SCSS file for each of them.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That's not a Node package&lt;/em&gt;&lt;br&gt;
Can't you just be nice with me for once ?&lt;/p&gt;

&lt;p&gt;Basically, you just have to import your stylesheet directly into your component file, and use class or even id, like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.pastas&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="no"&gt;yellow&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15px&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;And then :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./pastas.css&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;Pastas&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="na"&gt;className=&lt;/span&gt;&lt;span class="s2"&gt;"pastas"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        I use tomato, mushrooms and garlic on it.
    &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;Surprisingly easy, but efficient. You retrieve full power of CSS (yes I swear, it is) applied to your now wonderful component.&lt;/p&gt;

&lt;p&gt;Warning! Mocking Angular doesn't make a shadow DOM to appear by sorcery. You'll have to be sure you don't override some classes in an other file!&lt;/p&gt;

&lt;p&gt;To prevent that, give you a strict class naming (the same you've been doing with your variables, &lt;em&gt;huh&lt;/em&gt; ?) and build a sweet panel of reusable classes, in your root folder (In &lt;code&gt;styles/&lt;/code&gt; for example) for buttons, inputs, tables... whatsoever.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The big three : Material, Bootstrap, Tailwind CSS
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;I'm too lazy to write my own CSS framework&lt;/em&gt;&lt;br&gt;
Me too, and that's why some nice gentlemen, pour what we call...&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Some salt on your pastas ?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;CSS Frameworks&lt;/strong&gt;. Please be focus.&lt;/p&gt;

&lt;p&gt;There is A LOT of them out there, for different use cases, different paradigms, and different levels of liberty. I selected those I consider to be the big three, mainly used in the industry. If you're curious, check this &lt;a href="https://cssauthor.com/css-frameworks/"&gt;CSS census&lt;/a&gt;.&lt;/p&gt;
&lt;h4&gt;
  
  
  Material
&lt;/h4&gt;

&lt;p&gt;Instigated by Google designers, &lt;a href="https://material-ui.com/"&gt;Material&lt;/a&gt; has its own React package, providing plenty of already designed and reactive components, such as cards, modals, popovers, bread crumbs... Of course, it follows the Material Design guidelines for yourself, and you just have to focus on placing your UI elements together.&lt;/p&gt;
&lt;h4&gt;
  
  
  Bootstrap
&lt;/h4&gt;

&lt;p&gt;You may know &lt;a href="https://react-bootstrap.github.io/"&gt;Bootstrap&lt;/a&gt; if you have a Twitter account. Bootstrap main particularity is the use of a grid to place and size elements on screen.&lt;br&gt;
Divided in twelve columns, any component can place its children wherever you want.&lt;br&gt;
You may want to stack elements vertically, and Bootstrap rows are here for that.&lt;br&gt;
There's also a React library to use Bootstrap component.&lt;/p&gt;
&lt;h4&gt;
  
  
  Tailwind CSS
&lt;/h4&gt;

&lt;p&gt;At this point, I never have used &lt;a href="https://tailwindcss.com/"&gt;Tailwind CSS&lt;/a&gt;, but I will surely give it a try, as it seems to be a convenient way to use classes advantage, without being stuck behind a strong framework, hardly customizable.&lt;/p&gt;

&lt;p&gt;To keep it simple, Tailwind CSS use a configuration file, and a classname based syntax to provide style to component. As it is framework agnostic, you don't have to worry, and learn once for all the syntax. I let you visit their website to see what's going on!&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Stylesheets in JS (Styled-components, Emotion, Aphrodite)
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;OK cool but my components don't fit with anticipated use cases of CSS Frameworks, what should I do ?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;CSS Frameworks may be too restrictive on their styles, and you might want your app doesn't look the same as every other ones.&lt;/p&gt;

&lt;p&gt;Alternatively, you can find Node packages such as &lt;a href="https://www.npmjs.com/package/styled-components"&gt;style-components&lt;/a&gt;, &lt;a href="https://www.npmjs.com/package/aphrodite"&gt;aphrodite&lt;/a&gt; or even &lt;a href="https://www.npmjs.com/package/emotion"&gt;emotion&lt;/a&gt; that I particularly like.&lt;/p&gt;

&lt;p&gt;Each of those API are different, but are known as CSS in JS (kind of) solutions. You can see them as an improvement of React API, as they simply create Component for you, or just use &lt;code&gt;className&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;Again, I can't advise you more to write reusable code, by implementing atomic components, so you can add them where they're needed, and by updated at one place. for example, using emotion :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Button.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@emotion/styled&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
   &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yellow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Component.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Button&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;Component&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="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Buy Pastas&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&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;h3&gt;
  
  
  4. Context ?
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Great! What's the forth one ?&lt;/em&gt;&lt;br&gt;
There's no forth one.&lt;br&gt;
&lt;em&gt;What ? Are you a liar ?&lt;/em&gt;&lt;br&gt;
No, let me get this straight.&lt;/p&gt;

&lt;p&gt;What happens if I suddenly want to implement light and dark mode on my application ? How I'm supposed to implement my UI Components with that constraint ?&lt;br&gt;
You can use &lt;strong&gt;React Context&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What is React Context ?&lt;/em&gt;&lt;br&gt;
React Context is an amazing API to help developers to avoid props digging hell. If you have already written some components, you might have noticed that 3, 4, 5 or even 10 nested components is a pain when you want to pass a property from the original parent to the last child. That's props digging &lt;strong&gt;hell&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Fortunately, React developers take care of their users, and implement Context API.&lt;/p&gt;

&lt;p&gt;Because this one is off-topic, I'll let you read the documentation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Can you provide a link at least ?&lt;/em&gt;&lt;br&gt;
&lt;a href="https://reactjs.org/docs/context.html"&gt;There you go.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, I want to implement a light/dark mode, I'll build it over my previous example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// AppContext.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useContext&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;AppContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createContext&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;darkMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;useAppContext&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;useContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Appcontext&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// App.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;AppContext&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./AppContext&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="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="nc"&gt;AppContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&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;Component&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;AppContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Component.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&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="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Buy Pastas&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Button.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useAppContext&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./AppContext&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@emotion/styled&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;StyledButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;({},&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;darkMode&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="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;darkMode&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;black&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;'&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="nx"&gt;darkMode&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;black&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useAppContext&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// = { darkMode }&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;StyledButton&lt;/span&gt; &lt;span class="err"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;context&lt;/span&gt;&lt;span class="err"&gt;}&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;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="nc"&gt;StyledButton&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;It will demand you to alter context values with some actions, but this is another story ;)&lt;/p&gt;

&lt;p&gt;Although I used emotion in my example, the point here is that you are totally free to use any of the three first methods or packages combined with React Context!&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion, and personal thoughts
&lt;/h1&gt;

&lt;p&gt;Before concluding, I hope you enjoyed this article, it's my first one on tech, first one in english, and first of a long dynasty of interesting articles, dedicated for students, self taught programmers or curious!&lt;/p&gt;

&lt;p&gt;My point with this article is to show that React styles can be complicated to maintain, if you don't take it seriously, but so it is with databases, naming your variables, Angular... &lt;/p&gt;

&lt;p&gt;First method is the closest one to the old way of building websites, with only HTML, CSS and JS. Easy to maintain (especially with SCSS constants!) But not really suitable for React.&lt;/p&gt;

&lt;p&gt;CSS Frameworks are good, if you don't want to spend time or money on your design, and focus on programming. I don't recommend them if you already have a mock-up, mostly if it doesn't look the same. Because some of them don't really let you customize shapes, colors, themes, it can be more time consuming implement one than do it yourself, from scratch.&lt;/p&gt;

&lt;p&gt;CSS in JS packages are a good solution for this, but, you'll have to relearn them every time, as their API quite diverge.&lt;/p&gt;

&lt;p&gt;So keep in mind this table :&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Profile&lt;/th&gt;
&lt;th&gt;solutions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Boomers&lt;/td&gt;
&lt;td&gt;CSS / SCSS files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Noobs / Lazy devs&lt;/td&gt;
&lt;td&gt;CSS Frameworks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Designer born&lt;/td&gt;
&lt;td&gt;CSS in JS&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Thank you for reading me, it has been a pleasure to write this down!&lt;/p&gt;

&lt;p&gt;Stay safe, enjoy life, and happy coding!&lt;/p&gt;

</description>
      <category>react</category>
      <category>css</category>
    </item>
  </channel>
</rss>
