<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Gabriel Huguenin-Dumittan's blog]]></title><description><![CDATA[Hi, I'm Gabriel Huguenin-Dumittan and this is my personal blog]]></description><link>https://blog.huguenin.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 13:25:10 GMT</lastBuildDate><atom:link href="https://blog.huguenin.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[ReactJS Workshop]]></title><description><![CDATA[In this Workshop, I will guide you through the basics of ReactJS, a popular framework used to design efficiently and dynamically web front-ends Here you will learn how to download React, setup a React application and design some funny features using ...]]></description><link>https://blog.huguenin.dev/reactjs-workshop</link><guid isPermaLink="true">https://blog.huguenin.dev/reactjs-workshop</guid><category><![CDATA[React]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Gabriel Huguenin-Dumittan]]></dc:creator><pubDate>Sat, 08 Jan 2022 12:56:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1641597634382/ArEffhI58.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this Workshop, I will guide you through the basics of ReactJS, a popular framework used to design efficiently and dynamically web front-ends Here you will learn how to download React, setup a React application and design some funny features using this framework's main features.</p>
<h1 id="heading-a-brief-history-behind-react">A brief history behind React</h1>
<h2 id="heading-a-framework-full-of-potential">A framework full of potential</h2>
<h3 id="heading-beginning-of-react">Beginning of React</h3>
<p>With it's developement starting back in 2013, It started as a concept library, made to produce webpages using what are called components, making HTML pages production faster.</p>
<p>By that time, <a target="_blank" href="https://fr.wikipedia.org/wiki/PHP">PHP</a> was the leading language in order to produce dynamic pages (and is still widely used today due to it's age and support).</p>
<p>React, even though it's concept was new and so very likely to not be totally understood had pretty much no chance to fail as a framework since it was made and supported by Facebook employees who had a huge technical background and by that time, the web industry was not improving a lot.</p>
<h3 id="heading-going-truly-open-source">Going truly open source</h3>
<p>After October 2014, the framework went open source and by then, it has never stopped being supported, having numerous contributors and <a target="_blank" href="https://www.geeksforgeeks.org/top-10-most-popular-javascript-frameworks-for-web-development/">being the most downloaded JS framework of 2021</a>.</p>
<p>It gave JavaScript, it's mother language, a whole new field of use since it was not originally designed to run web applications.</p>
<h2 id="heading-whats-even-javascript">What's even JavaScript ?</h2>
<h3 id="heading-java">Java ?</h3>
<p>JavaScript was created back in 1996 and is today handled by the Mozilla Organization, its name is a pure marketing maneuver, Java, another language was at that time very trendy because of it's pretty much limitless use case and virtual environnement. The creators decided to name it similarly to make it more attractive, which actually worked even though they have very little common characteristics.</p>
<h3 id="heading-script">Script ?</h3>
<p>First thought as a scripting language, used to assist within another language's program, it was thought with it's own data format, named <a target="_blank" href="https://www.w3schools.com/js/js_json_intro.asp">JSON</a> (JavaScript object notation), today it's name is very inadequate since it's more of a web language than really a scripting language.</p>
<h3 id="heading-were-not-going-to-use-javascript">We're not going to use JavaScript</h3>
<p>React introduces a new way of writing html through JavaScript, it is called <a target="_blank" href="https://fr.reactjs.org/docs/introducing-jsx.html">JSX</a>. This format allows the implementation of HTML tags within JS files. This format can be used in a .js file since the language isn't strict with file formatting but for the sake of understanding more easily our code, we'll use .jsx file formats.</p>
<p>These components are ruled by hooks which is a fundamental mechanic of this framework. Hooks are variables or methods that regenerate the components they are used in each time they change.</p>
<h2 id="heading-main-mechanics">Main mechanics</h2>
<h3 id="heading-components">Components</h3>
<p>Components are the core property of React, the application is divided into little code chunks that each represent a feature or visual asset, these are components, they can hold variables, functions like objects and HTML tags and are ruled by properties which we call <a target="_blank" href="https://fr.reactjs.org/docs/components-and-props.html">props</a>.</p>
<h3 id="heading-hooks">Hooks</h3>
<p><a target="_blank" href="https://fr.reactjs.org/docs/hooks-intro.html">Hooks</a> are what allows our application to be dynamic. They are variables that, when used within a component, will trigger a re-render of it's parent component when it changes. A very simple example is a counter, clicking it increments a value that is a hook, it's change re-renders the counter which then shows the newly incremented counter.</p>
<p>Easy, isn't it ?</p>
<p>And with that you have pretty much anything to go on, don't you ?</p>
<h3 id="heading-conditional-rendering">Conditional rendering</h3>
<p>Quite explicit, you can render chunks or components or entire components based on conditions. You can choose to display or not an element based on the user's device format, it's personal informations or other parameters such as time or location. It is explained in details <a target="_blank" href="https://fr.reactjs.org/docs/conditional-rendering.html">here</a></p>
<h3 id="heading-modules">Modules</h3>
<p>Just like in other languages you can import foreign code but in this case you can import any module that is an NPM package, a node package, using other people's code they publish for free. There are ALOT of packages out there that will make your development faster.</p>
<h3 id="heading-how-does-that-run">How does that run ?</h3>
<p>JavaScript cannot run by itself and does not have a default creator-made interpreter such as python's interpreter. We're gonna need something to run it.</p>
<p>Remember node i just mentioned ? It's the engine behind React (and many more frameworks), it's gonna allow use to download, install and run all the code you wrote down as well as the packages you imported.</p>
<p>Node can be used on Windows, MacOS and Linux, not environnement constraint !</p>
<h2 id="heading-is-it-really-that-useful-to-learn-react">Is it really that useful to learn React ?</h2>
<p>Being widely used across the web and but trustful companies such as Netflix, Yahoo, Airbnb and even Facebook themselves, there's no doubt, seeing the quality of these websites and web applications that you can jump into React.</p>
<p>It's potential has even grown recently since the apparition of React Native, a derivative version which is aimed towards mobile applications on both iOS and Android so learning React is a huge gateway to sta.</p>
<h1 id="heading-lets-get-started">Let's get started !</h1>
<h2 id="heading-installing-react">Installing React</h2>
<p>Before installing React itself you're gonna need to install <a target="_blank" href="https://nodejs.org/en/">Node and npm</a>, <strong>please install LTS version, not the latest</strong></p>
<p>Once installed, you can go into your terminal in Linux or your powershell in Windows and we'll finally get some code.</p>
<p>We'll use the <code>npx create-react-app [Your app name in lowercase]</code> command, this command is gonna generate all the basics to run a simple web applications, this code is always gonna be the same at the beginning and is tidy to write, we call that <strong>boilerplate code</strong>.</p>
<p><em>If the command prompt asks you to install the 'create-react-app' package, just type 'yes' or 'y' to accept</em></p>
<p>This command should have generated a directory.</p>
<p>Go into that one and run the following command</p>
<p><code>npm install</code></p>
<p>This may take a while, it converts node packages into node modules which can be read and ran by your code.</p>
<h2 id="heading-run-your-app">Run your app !</h2>
<p>When at the root of your project (At the same level as the <strong>package.json</strong> which is a file describing your project's properties and the packages it holds) simply run</p>
<p><code>npm start</code></p>
<p>Node will run the project's code and even better, open a web tab to show you the website. What's best about that is you can modify your code while running the node instance and the website will update instantly without having you to recompile or restart the app.</p>
<p><strong>FInally !</strong></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> logo <span class="hljs-keyword">from</span> <span class="hljs-string">'./logo.svg'</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">'./App.css'</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> (
        <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App"</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">header</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App-header"</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">{logo}</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App-logo"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">"logo"</span> /&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>
                    Edit <span class="hljs-tag">&lt;<span class="hljs-name">code</span>&gt;</span>src/App.js<span class="hljs-tag">&lt;/<span class="hljs-name">code</span>&gt;</span> and save to reload.
                <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">a</span>
                    <span class="hljs-attr">className</span>=<span class="hljs-string">"App-link"</span>
                    <span class="hljs-attr">href</span>=<span class="hljs-string">"https://reactjs.org"</span>
                    <span class="hljs-attr">target</span>=<span class="hljs-string">"_blank"</span>
                    <span class="hljs-attr">rel</span>=<span class="hljs-string">"noopener noreferrer"</span>
                &gt;</span>
                    Learn React
                <span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">header</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
    );
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> App;
</code></pre>
<p>Here you have the App.js file which is where you will start implementing code. js files are used with CSS files to customize components and tags</p>
<h2 id="heading-simple-hook-example">Simple hook example</h2>
<p>Here we create a counter with an increment button.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> logo <span class="hljs-keyword">from</span> <span class="hljs-string">'./logo.svg'</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">'./App.css'</span>;
<span class="hljs-keyword">import</span> { useState } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{

    <span class="hljs-keyword">const</span> [counter, setCounter] = useState(<span class="hljs-number">0</span>);

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">incrementCounter</span>(<span class="hljs-params"></span>) </span>{
        setCounter(counter + <span class="hljs-number">1</span>);
    }

    <span class="hljs-keyword">return</span> (
        <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App"</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">header</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App-header"</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">{logo}</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App-logo"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">"logo"</span> /&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>
                    Edit <span class="hljs-tag">&lt;<span class="hljs-name">code</span>&gt;</span>src/App.js<span class="hljs-tag">&lt;/<span class="hljs-name">code</span>&gt;</span> and save to reload.
                <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> incrementCounter()}&gt;Click me !<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>{counter}<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">header</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
    );
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> App;
</code></pre>
<blockquote>
<p>What's all of that Gabriel ?! I don't even know what I'm typing.</p>
</blockquote>
<p>Don't panic, we're gonna divide each part and explain what they are used for.</p>
<p><code>const [counter, setCounter] = useState(0);</code> is a hook, we declare it using useState which is React's hook creation function.</p>
<p>We use <code>const</code> since we're not gonna re attribute it (No such thing as <code>counter = 1</code> in our code)</p>
<p><code>counter</code> will be our variable and <code>setCounter</code> the function we call to change <code>counter</code>, this is how you must do.</p>
<p><code>useState(0)</code> means this is gonna be a hook and <code>0</code> is the value you want your hook variable to be initialized with. So here our counter will start from <code>0</code></p>
<p>Right after you have a function which calls the counter setter function. <code>setCounter(counter + 1)</code> increments the counter variable by 1, simple as that.</p>
<p>After that we want a button in our page so I added a tag right under the text, buttons have a <code>onClick</code> attribute to which you can pass a function as i did so it executes each time you click on the component. And that's it ! That was really boring Gabriel, I want to do something more <em>vibrant</em> Color changing hook Ok, ok. How about changing colors ? This time we'll do something funnier, change the background depending on a text color input. First let's understand how to change a color of a component. For those who know CSS, we can reuse CSS properties with hooks, to do that we call the <code>style</code> property of any React component and can assign easily a variable. Let's say you want to change the background color to white (#fff or #ffffff) in hexadecimal notation, you can do as follows: If you are not comfortable with hexadecimal colors you can understand them using these two links: <a target="_blank" href="https://www.w3schools.com/colors/colors_picker.asp">Understanding hex notation</a> <a target="_blank" href="https://htmlcolorcodes.com/fr/">RGB Color picker</a> You can simply call the backgroundColor attribute within style and define it's value. Try it with any color that comes to your mind ! Here I use an <code>&lt;input&gt;</code> component which you can read about <a target="_blank" href="https://fr.reactjs.org/docs/forms.html">here</a> of <code>type="text"</code> to handle text. It has a <code>onChange</code> property which is called each time the input changes. We get <code>e</code> from it which is the event fired each time we update the input. We can get the value of the event by getting <code>e.target.value</code> We pass that to a function which updates a hook, the <code>color</code> hook variable. Each time it updates we add an <code>#</code> in front of it to define it's a color value. We then define the <code>backgroundColor</code> as the <code>color</code> hook. Now try that and type something in the page's input. Here's an example, where I input pink color's code, it updates instantly ! Yup that's still way too easy. Now try to build a Portfolio Having all the basics to create components you can build a portfolio that you can use for yourself. You can see <a target="_blank" href="https://huguenin.dev/">my own website</a> as an example of a React website. With little practice and some package search you should be able to do the same ! Any question ? If you happen to love React as I do, you can read alot on <a target="_blank" href="https://reactjs.org/">their official website</a> which has a great documentation. If you have any personal or technical question you want to ask me. Feel free to contact me through my social medias or by sending me an email. You can find these informations on <a target="_blank" href="https://huguenin.dev/">my website</a>. I'll be glad to help you.</p>
]]></content:encoded></item><item><title><![CDATA[Hello World !]]></title><description><![CDATA[Nothing to see here, move on !]]></description><link>https://blog.huguenin.dev/hello-world</link><guid isPermaLink="true">https://blog.huguenin.dev/hello-world</guid><dc:creator><![CDATA[Gabriel Huguenin-Dumittan]]></dc:creator><pubDate>Fri, 07 Jan 2022 12:52:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1641560923774/FozRE6-lO.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Nothing to see here, move on !</p>
]]></content:encoded></item></channel></rss>