<?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: Manuel Ojeda</title>
    <description>The latest articles on DEV Community by Manuel Ojeda (@manuelojeda).</description>
    <link>https://dev.to/manuelojeda</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%2F232907%2F811f85ec-b815-41ab-bd3e-cf978a6f9719.jpg</url>
      <title>DEV Community: Manuel Ojeda</title>
      <link>https://dev.to/manuelojeda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/manuelojeda"/>
    <language>en</language>
    <item>
      <title>Create a proper debug setup in VS Code with Laravel Sail in Linux</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Wed, 23 Feb 2022 16:18:31 +0000</pubDate>
      <link>https://dev.to/manuelojeda/create-a-proper-debug-setup-in-vs-code-with-laravel-sail-57kn</link>
      <guid>https://dev.to/manuelojeda/create-a-proper-debug-setup-in-vs-code-with-laravel-sail-57kn</guid>
      <description>&lt;p&gt;Laravel give to us a lot of different dev enviroments, from &lt;a href="https://laravel.com/docs/9.x/homestead" rel="noopener noreferrer"&gt;&lt;strong&gt;Laravel Homestead&lt;/strong&gt;&lt;/a&gt;, &lt;a href="https://laravel.com/docs/9.x/valet" rel="noopener noreferrer"&gt;&lt;strong&gt;Laravel Valet&lt;/strong&gt;&lt;/a&gt;, and the newest adittion: &lt;a href="https://laravel.com/docs/9.x#getting-started-on-linux" rel="noopener noreferrer"&gt;&lt;strong&gt;Laravel Sail&lt;/strong&gt;&lt;/a&gt;, which is the default enviroment for Laravel because it gives to us a quick and in no-time enviroment using Docker. This brings the possibility that our project works in every operative system, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MacOS&lt;/li&gt;
&lt;li&gt;Windows&lt;/li&gt;
&lt;li&gt;Linux&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide will help to you to make the proper config without any issue to develop and debug with Laravel Sail and VS Code which has a great &lt;a href="https://code.visualstudio.com/Docs/editor/debugging" rel="noopener noreferrer"&gt;&lt;strong&gt;Debugger&lt;/strong&gt;&lt;/a&gt; and is so powerful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Previous steps
&lt;/h3&gt;

&lt;p&gt;At this point I'll suppose that you already have Docker installed. In case you don't you can follow this &lt;a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener noreferrer"&gt;guide&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create a new Laravel Sail project
&lt;/h3&gt;

&lt;p&gt;We will execute the next command to create an example project, you can change the &lt;code&gt;example-app&lt;/code&gt; with any name you want to give to your project:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

curl -s https://laravel.build/example-app | bash


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

&lt;/div&gt;

&lt;p&gt;Wait until is ready, it will take some time if this is the first time you do this process because is downloading all the images from Docker and the project dependencies (in case you have did this before, it won't take much longer).&lt;/p&gt;

&lt;p&gt;And to finish this step, we change to the new project with:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

cd ./example-app


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  2. Publish all the Docker config files
&lt;/h3&gt;

&lt;p&gt;Once we are inside the directory, we need to turn on the project with:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

./vendor/bin/sail up -d


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

&lt;/div&gt;

&lt;p&gt;And then we run the next command to publish the Docker config files we need to edit:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

./vendor/bin/sail artisan sail:publish


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

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6bx0fmrtsfa443mncez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6bx0fmrtsfa443mncez.png" alt="Carpetas creadas trás la publicación"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the project with:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

code .


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

&lt;/div&gt;

&lt;p&gt;Now we can stop the project with:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

./vendor/bin/sail down


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

&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

./vendor/bin/sail stop


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  3. Config the project
&lt;/h3&gt;

&lt;p&gt;Open &lt;code&gt;docker-compose.yml&lt;/code&gt; and add the next:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;


&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;laravel.test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;context&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./docker/8.1&lt;/span&gt;
            &lt;span class="na"&gt;dockerfile&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Dockerfile&lt;/span&gt;
            &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;WWWGROUP&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${WWWGROUP}'&lt;/span&gt;
                &lt;span class="c1"&gt;# add these two lines&lt;/span&gt;
                &lt;span class="na"&gt;XDEBUG&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${APP_DEBUG:-false}'&lt;/span&gt;
                &lt;span class="na"&gt;XDEBUG_PORT&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${SAIL_XDEBUG_PORT:-9003}'&lt;/span&gt;

&lt;span class="c1"&gt;# we need to expose the port 9003,&lt;/span&gt;
&lt;span class="c1"&gt;# so we add the line after the ports are declared.&lt;/span&gt;
&lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${APP_PORT:-80}:80'&lt;/span&gt;
&lt;span class="na"&gt;expose&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;9003"&lt;/span&gt;
&lt;span class="c1"&gt;# Add XDEBUG_CONFIG, PHP_XDEBUG_ENABLED y XDEBUG_MODE&lt;/span&gt;
&lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;WWWUSER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${WWWUSER}'&lt;/span&gt;
    &lt;span class="na"&gt;LARAVEL_SAIL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
    &lt;span class="na"&gt;XDEBUG_CONFIG&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${SAIL_XDEBUG_CONFIG:-client_host=172.120.19.9}&lt;/span&gt;
    &lt;span class="na"&gt;PHP_XDEBUG_ENABLED&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
    &lt;span class="na"&gt;XDEBUG_MODE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${SAIL_XDEBUG_MODE:-off}'&lt;/span&gt;

&lt;span class="c1"&gt;# And in the networks section has:&lt;/span&gt;
&lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;sail&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;driver&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bridge&lt;/span&gt;

&lt;span class="c1"&gt;# Add after the driver configutation:&lt;/span&gt;
&lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;sail&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;driver&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bridge&lt;/span&gt;
        &lt;span class="na"&gt;ipam&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;driver&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
            &lt;span class="na"&gt;config&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="c1"&gt;# In this case you can add whatever subnet you want of you can live it as this guide has.&lt;/span&gt;
                &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;subnet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;172.120.19.0/24&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;We are done with the &lt;code&gt;docker-compose.yml&lt;/code&gt; config, now we go and edit &lt;code&gt;./docker/8.1/php.ini&lt;/code&gt; and add to the end of the file:&lt;/p&gt;

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

&lt;span class="nn"&gt;[XDebug]&lt;/span&gt;
&lt;span class="py"&gt;xdebug.start_with_request&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;yes&lt;/span&gt;
&lt;span class="py"&gt;xdebug.show_local_vars&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;on&lt;/span&gt;
&lt;span class="py"&gt;xdebug.mode&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;debug&lt;/span&gt;
&lt;span class="py"&gt;xdebug.discover_client_host&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;true&lt;/span&gt;
&lt;span class="py"&gt;xdebug.client_host&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;host.docker.internal&lt;/span&gt;
&lt;span class="py"&gt;xdebug.client_port&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;9003&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Last but not least we modify the &lt;code&gt;.env&lt;/code&gt; add in the end of the file:&lt;/p&gt;

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

SAIL_XDEBUG_MODE=develop,debug
SAIL_XDEBUG_CONFIG="client_host=localhost"


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

&lt;/div&gt;

&lt;p&gt;Once we have everything set, we should turn on the project once more but rebuilding everything again (it won't take too much time, I promise!):&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

&lt;p&gt;./vendor/bin/sail up --build -d&lt;/p&gt;

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

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  

&lt;ol&gt;
&lt;li&gt;Set up VSCode to work with Laravel Sail
&lt;/li&gt;
&lt;/ol&gt;
&lt;/h3&gt;


&lt;p&gt;Open VScode and we are going to need the next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install PHP Debug&lt;/li&gt;
&lt;li&gt;Install Docker and Remote Explorer&lt;/li&gt;
&lt;li&gt;Config the debugger&lt;/li&gt;
&lt;li&gt;Install Xdebug Helper in your browser&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Install PHP Debug
&lt;/h4&gt;

&lt;p&gt;We need to install the next extension, in case you don't have it: &lt;br&gt;
&lt;a href="https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug" rel="noopener noreferrer"&gt;https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Install Docker and Remote Explorer
&lt;/h4&gt;

&lt;p&gt;In case you don't have it, install: &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker" rel="noopener noreferrer"&gt;https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker&lt;/a&gt; y &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers" rel="noopener noreferrer"&gt;https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers&lt;/a&gt;&lt;br&gt;
this will help us to gain access through VS Code to the project container and we can edit the code we need while we are in the development.&lt;/p&gt;

&lt;p&gt;Once installed we click in here:&lt;/p&gt;

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

&lt;p&gt;This button will show a list of running containers from your system, in this case we need to select the one that finished with &lt;strong&gt;laravel.test_1&lt;/strong&gt; and doing a click here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb073rcir241ekc89w5w0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb073rcir241ekc89w5w0.png" alt="Select remote container"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the container is open in VSCode we need to open the next directory &lt;code&gt;/var/www/html&lt;/code&gt;, the Laravel code resides here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; We need to confirm that we have &lt;strong&gt;PHP Debug&lt;/strong&gt; installed by navigating the extensions list, in case is not installed it will have the next label &lt;code&gt;Install in Container...&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Config the debugger
&lt;/h4&gt;

&lt;p&gt;Finally we go the Debugger section and &lt;strong&gt;create a launch.json file&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1yoam9t0temhyun5any1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1yoam9t0temhyun5any1.png" alt="Crear configuración del debugger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will show a list of languages we can debug, in this case select PHP. It will open a newly created file, delete all the object inside the configurations array and put this config:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Use&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;IntelliSense&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;learn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;possible&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;attributes.&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Hover&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;view&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;descriptions&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;existing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;attributes.&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;For&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;more&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;information&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;visit:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&lt;a href="https://go.microsoft.com/fwlink/?linkid=" rel="noopener noreferrer"&gt;https://go.microsoft.com/fwlink/?linkid=&lt;/a&gt;&lt;/span&gt;&lt;span class="mi"&gt;830387&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"configurations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Listen for Xdebug"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"php"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"launch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"port"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;9003&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"pathMappings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"/var/www/html"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${workspaceFolder}"&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;&lt;br&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

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

&lt;/div&gt;
&lt;h4&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Install Xdebug helper&lt;br&gt;
&lt;/h4&gt;

&lt;p&gt;Now go to your browser and install:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chrome: &lt;a href="https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc" rel="noopener noreferrer"&gt;https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Firefox: &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/xdebug-helper-for-firefox/" rel="noopener noreferrer"&gt;https://addons.mozilla.org/en-US/firefox/addon/xdebug-helper-for-firefox/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Look up for the extension and click it, it will show a list and enable  &lt;strong&gt;Debug&lt;/strong&gt;, this will help us to send the signal from our browser to your IDE to start the debugging when you visit a route:&lt;/p&gt;

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

&lt;p&gt;And we are ready! We have our VS Code done with this config asnd ready to debug.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Testing
&lt;/h3&gt;

&lt;p&gt;Now go to VS Code and edit &lt;code&gt;routes/web.php&lt;/code&gt;, select a breakpoint like in the image and press &lt;strong&gt;F5&lt;/strong&gt;, it will start the debug session:&lt;/p&gt;

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

&lt;p&gt;Open up the browser and go to &lt;code&gt;http://localhost&lt;/code&gt;, it should automatically execute the debugger in VSCode, like this:&lt;/p&gt;

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

&lt;p&gt;And we are ready! I hope this works for you and all I have to say is:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Happy hunting!&lt;/strong&gt;
&lt;/h2&gt;

</description>
      <category>laravel</category>
      <category>vscode</category>
      <category>debug</category>
      <category>php</category>
    </item>
    <item>
      <title>Learn to create your custom Global State Management with Vue 3</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Mon, 10 May 2021 19:46:09 +0000</pubDate>
      <link>https://dev.to/manuelojeda/learn-to-create-your-custom-global-state-management-with-vue-3-11am</link>
      <guid>https://dev.to/manuelojeda/learn-to-create-your-custom-global-state-management-with-vue-3-11am</guid>
      <description>&lt;h1&gt;
  
  
  Learn to create your custom Global State Management with Vue 3
&lt;/h1&gt;

&lt;p&gt;Since Vue 3 Beta days we knew how awesome this framework was going to be, and since it annoucement we knew they did a monorepo making a lot of the feature from the framework available outside a &lt;strong&gt;Vue&lt;/strong&gt; component, with this I mean:&lt;/p&gt;

&lt;div class="highlight js-code-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="cm"&gt;/* Anything you need from Vue goes here */&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;vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;So we are going to use this advantage to create a simple but powerful Global State Management with a single few steps, so let's get started.&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's create a simple app
&lt;/h2&gt;

&lt;p&gt;For this example let use a simple example, a counter that comes for default using the amazing &lt;a href="https://vitejs.dev/" rel="noopener noreferrer"&gt;Vite.js&lt;/a&gt;, for this we need to run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;

npm init @vitejs/app storex (or the name you want to use)


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

&lt;/div&gt;

&lt;p&gt;After that, select &lt;strong&gt;vue&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Then &lt;strong&gt;JavaScript&lt;/strong&gt; or &lt;strong&gt;TypeScript&lt;/strong&gt;, it will work in both:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5s7vu6bb2xmo1tskzvuo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5s7vu6bb2xmo1tskzvuo.png" alt="Select JS or TS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then follow the rest by changing into the recently created project and run &lt;strong&gt;npm install&lt;/strong&gt; and open up the code in the the editor of your preference.&lt;/p&gt;




&lt;h2&gt;
  
  
  Creating the store
&lt;/h2&gt;

&lt;p&gt;Let's begin with the store by creating a new folder inside the &lt;strong&gt;src&lt;/strong&gt; folder by naming it, as you probably guess it, &lt;strong&gt;store&lt;/strong&gt; and create a &lt;strong&gt;index.js&lt;/strong&gt; inside the folder, the project directories should look like somethimg like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxvp2hd6gso4zmmz0a4lh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxvp2hd6gso4zmmz0a4lh.png" alt="Creating the store directory"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once created the index file open it and place the next code:&lt;/p&gt;

&lt;div class="highlight js-code-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;reactive&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;vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;reactive&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
  &lt;span class="na"&gt;getters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;getCount&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;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;mutations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;incrementCount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&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="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;initializeCount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&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;0&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="nx"&gt;store&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Let explain why the store is created like this:&lt;/p&gt;

&lt;div class="highlight js-code-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;reactive&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;vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// We need to import the reactive function from Vue to make the&lt;/span&gt;
&lt;span class="c1"&gt;// global object reactive and get the treatment like this was Vuex&lt;/span&gt;


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

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

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="c1"&gt;// Create a state with the reactive function we imported previously, this will manage the reactivity for us&lt;/span&gt;
  &lt;span class="na"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;reactive&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; 
    &lt;span class="c1"&gt;// If this is null is for the example,&lt;/span&gt;
    &lt;span class="c1"&gt;// of course you can initialize the&lt;/span&gt;
    &lt;span class="c1"&gt;// counter with 0 directly&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
  &lt;span class="c1"&gt;// This section will handle the getters&lt;/span&gt;
  &lt;span class="na"&gt;getters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;getCount&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;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="c1"&gt;// This section will manage the changes into the state&lt;/span&gt;
  &lt;span class="na"&gt;mutations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;incrementCount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&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="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="c1"&gt;// This section will manage the actions needed for our store&lt;/span&gt;
  &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;initializeCount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&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;0&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;And that's it, the store is created, now we need to use it in our app.&lt;/p&gt;




&lt;h2&gt;
  
  
  Using the Store in the App
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;main.js&lt;/strong&gt; file in the root of &lt;strong&gt;src&lt;/strong&gt; and change the code with this:&lt;/p&gt;

&lt;div class="highlight js-code-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;createApp&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;vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;store&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;./store&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&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;./App.vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initializeCount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="cm"&gt;/*
* By default the main.js comes like this:
* createApp(app)
* .mount(#app)
* We changed a little the behaviour by assigning the createApp 
* to the const app to avoid the mount before initializing the store
*/&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;In &lt;strong&gt;App.js&lt;/strong&gt; we need to change or add the store to track correctly in a global way when we are debugging/testing the application, so let's add the &lt;strong&gt;state&lt;/strong&gt; as a computed property:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;App.vue&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you want to use this sugar syntax, this all what you need, but be aware that the complete store is visible in the Dev Tools:&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;script &lt;/span&gt;&lt;span class="na"&gt;setup&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&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;computed&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;@vue/runtime-core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;HelloWorld&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;./components/HelloWorld.vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;store&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;./store&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computed&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;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgr2t7ze4og6nwuj502d6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgr2t7ze4og6nwuj502d6.png" alt="The store is visible in the Dev Tools"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;center&gt;As mentioned the store is completily visible in the dev tools&lt;/center&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In case you want to make only the state visible you need to change the code like this but always using the Composition API:&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;script&amp;gt;&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;defineComponent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;computed&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;@vue/runtime-core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;HelloWorld&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;./components/HelloWorld.vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;store&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;./store&lt;/span&gt;&lt;span class="dl"&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="nf"&gt;defineComponent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;components&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;HelloWorld&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="nf"&gt;setup &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;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computed&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;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&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="nx"&gt;state&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="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2yvlb1oa3r71o8vvc6ad.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2yvlb1oa3r71o8vvc6ad.png" alt="State only visible in the dev tools"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;center&gt;Only the state is visible in dev tools, so this is easily to debug when is needed&lt;/center&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;HelloWorld.vue&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Open up &lt;strong&gt;HelloWorld.vue&lt;/strong&gt; which can be found in the &lt;strong&gt;Components&lt;/strong&gt; directory.&lt;/p&gt;

&lt;p&gt;Once is ready to edit you need to change the code for this:&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;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;{{ msg }}&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://vitejs.dev/guide/features.html"&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      Vite Documentation
    &lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
    |
    &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://v3.vuejs.org/"&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Vue 3 Documentation&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

  &lt;span class="c"&gt;&amp;lt;!-- 
    You need to change the @click for the method created that
    will handle the change from the store
    Also change the count inside the {{  }}
  --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="na"&gt;click=&lt;/span&gt;&lt;span class="s"&gt;"increment"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;count is: {{ count }}&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
    Edit
    &lt;span class="nt"&gt;&amp;lt;code&amp;gt;&lt;/span&gt;components/HelloWorld.vue&lt;span class="nt"&gt;&amp;lt;/code&amp;gt;&lt;/span&gt; to test hot module replacement.
  &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- 
  Change the script from the sugar syntax 
  to the Oficial Composition API way
--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&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;defineComponent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;computed&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;vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// Import the store&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;store&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;../store&lt;/span&gt;&lt;span class="dl"&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="nf"&gt;defineComponent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="nf"&gt;setup &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Send the count as a computed value from&lt;/span&gt;
    &lt;span class="c1"&gt;// the getters in the store&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="nf"&gt;computed&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;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getCount&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="c1"&gt;// This method will commit the change from the store&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;increment&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="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mutations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;incrementCount&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="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&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="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;style &lt;/span&gt;&lt;span class="na"&gt;scoped&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;a&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="m"&gt;#42b983&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;And we get this final result!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkvexy27ucd4dwbmztjka.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkvexy27ucd4dwbmztjka.gif" alt="Our app is working"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it!!! We have created a simple but powerful Global State Management using the tools that Vue gives us and is fantastic what we can create from it, of course if you need advanced features I recommend to use &lt;a href="https://github.com/posva/pinia" rel="noopener noreferrer"&gt;Pinia&lt;/a&gt; or &lt;a href="https://github.com/vuejs/vuex" rel="noopener noreferrer"&gt;Vuex&lt;/a&gt;, but if you don't want to add more weight into your project this simple State Management should be enough.&lt;/p&gt;

&lt;p&gt;Tell me what you think of this trick in the commentary and I hope is helpful for you, see around the next time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia1.tenor.com%2Fimages%2F88ae11548eb77b751325c3ff493cddcc%2Ftenor.gif" 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%2Fmedia1.tenor.com%2Fimages%2F88ae11548eb77b751325c3ff493cddcc%2Ftenor.gif" alt="See you soon"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>vue3</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to setup WSL 2 - The easy way</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Sun, 07 Jun 2020 19:48:46 +0000</pubDate>
      <link>https://dev.to/manuelojeda/how-to-setup-wsl-2-the-easy-way-3mg6</link>
      <guid>https://dev.to/manuelojeda/how-to-setup-wsl-2-the-easy-way-3mg6</guid>
      <description>&lt;p&gt;WSL has become a popular choice tool of developmnet in Windows 10. With this tool you don't need to make a dual boot setup in your PC to have all the potencial of Linux because WSL gives you all what you need to start the developent ASAP, but of course WSL have some flaws like slow performance for I/O, slow file system mainly.&lt;/p&gt;

&lt;p&gt;Microsoft released in the last main update for Windows 10 (Release 2004, build 19041 or newer) the new version of WSL, WSL 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  But why WSL 2?
&lt;/h2&gt;

&lt;p&gt;The main feature of WSL 2 is giving a better performace comparing it with WSL 1, MS did a great work that they boosted up to 20x times than the original version (that's a lot! 🤯), and of course there are many features like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full System Call Compatibility&lt;/li&gt;
&lt;li&gt;Small memory usage&lt;/li&gt;
&lt;li&gt;Accesing to WSL files in Windows Explorer though the network section&lt;/li&gt;
&lt;li&gt;And mainly, Full Linux Kernal&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What do I need to run WSL 2?
&lt;/h2&gt;

&lt;p&gt;As I said before, you need to have &lt;strong&gt;Windows 10 Release 2004 Build 19041 or newer&lt;/strong&gt; and any other Windows 10 than Windows 10 S according to MS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;First, we need to enable as usual WSL into out system and Hyper-V, a virtualization tool from Microsoft, this VM tool is needed because WSL 2 works as a kind of Virtual Machine, but in the unique way from Microsoft (this is where the magic happens)&lt;/p&gt;

&lt;p&gt;Press the &lt;strong&gt;Windows&lt;/strong&gt; key and type &lt;em&gt;features&lt;/em&gt; and select: &lt;strong&gt;Activate or deactivate Windows features&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbgo9y62uaw44ygn8zw2b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbgo9y62uaw44ygn8zw2b.png" alt="Activate or deactivate Windows features"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An small windows with a list of features available for our system, we need to look for &lt;strong&gt;Hyper-V&lt;/strong&gt; and &lt;strong&gt;Windows Subsystem for Linux&lt;/strong&gt;, scroll through the list and check both options.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F296m3usppatl5f9n6t2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F296m3usppatl5f9n6t2m.png" alt="Hyper-V option"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcjpeine4te09nhdrn077.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcjpeine4te09nhdrn077.png" alt="WSL option"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After both options are checked, press Accept (or OK, sorry for the spanish). Windows will start downloading the files needed, after it finishes, it will propmt to you to Restart your machine, accept the restart.&lt;/p&gt;

&lt;p&gt;Once your machine restarted, you are ready to download Ubuntu from the Microsoft Store, search it through the Windows Store or from this &lt;a href="https://www.microsoft.com/es-us/p/ubuntu/9nblggh4msv6?activetab=pivot:overviewtab" rel="noopener noreferrer"&gt;link&lt;/a&gt;. Once the download is done, run the app, wait until the installation is ready and setup your user, we are almost done.&lt;/p&gt;

&lt;p&gt;As you can see, this is the normal process from WSL 1, but this is the aditional step we need to do, open up &lt;strong&gt;Powershell&lt;/strong&gt; and type: &lt;strong&gt;wsl --list --verbose&lt;/strong&gt;, running this command should list your distro as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Distro Status  Version
Ubuntu Stopped 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, we still have WSL 1 being selected for our distro, to setup WSL 2 we need to run this command: &lt;code&gt;wsl --set-version &amp;lt;your-distro-name&amp;gt; 2&lt;/code&gt;, using the example should be: &lt;code&gt;wsl --set-version Ubuntu 2&lt;/code&gt;, it will show you a message that it will take some time to make the conversion to WSL 2, at this point you can do anything else like going for some coffee, stretch up your arms or legs, anything because it will some minutes (around 10-15 minutes).&lt;/p&gt;

&lt;p&gt;Once the process is completed run once again the command: &lt;code&gt;wsl --list --verbose&lt;/code&gt; or &lt;code&gt;wsl -l -v&lt;/code&gt; as a shortcut, the list should display as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Distro Status  Version
Ubuntu Stopped 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now we have WSL 2 ready to rock!&lt;/p&gt;

&lt;h2&gt;
  
  
  Especial considerations
&lt;/h2&gt;

&lt;p&gt;By using WSL 2 we need to have some special considerations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don't use any app in Windows that uses Port 53, this port is needed by Hyper-V to have access to the internet and Windows, so if you have an app like Acrylic UI, this will prevent to WSL 2 start up running.&lt;/li&gt;
&lt;li&gt;If you are a Laravel developer, careful by installing &lt;code&gt;cpriego/valet-linux&lt;/code&gt;, it will block your access to internet from your distro (I had some issues by trying to git pull a project until I found out it was the problem)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's it, is all for now, I hope this guide helps you with the process, see you next time around here.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wsl</category>
      <category>terminal</category>
    </item>
    <item>
      <title>TypeScript - Interfaces</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Thu, 14 May 2020 16:48:45 +0000</pubDate>
      <link>https://dev.to/manuelojeda/typescript-interfaces-22kg</link>
      <guid>https://dev.to/manuelojeda/typescript-interfaces-22kg</guid>
      <description>&lt;h1&gt;
  
  
  TypeScript: Interfaces
&lt;/h1&gt;

&lt;p&gt;As we read before, the typing system from TypeScript is the main feature inside this superset by adding a strong typed system into JavaScript. Now, one of the most used features is called: &lt;strong&gt;Interfaces&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an Interface?
&lt;/h2&gt;

&lt;p&gt;An &lt;strong&gt;Interface&lt;/strong&gt; we can calling as a properties contract with need to be fulfilled in order to satisfy the requirement in the code about that Interface. The sintax is pretty simple, to declare an interface need to be like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;PutYourInterfaceNameHere&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;yourProperty&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;here&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="c1"&gt;// The ? is optional and you indicate into the contract that property is optional and is not required to fulfill the interface.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Foo&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;- Needs to be PascalCase&lt;/span&gt;
  &lt;span class="nl"&gt;Bar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;MyBar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;MyFoo&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;number&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 how to use it? Just like a type, you need to declare it as a type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;MyFooExample&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Foo&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Benefits? If you are using VS Code, Intellisense will be listening and helping you by showing all the properties that the interface has, also you can make a group of types you need in case you are using OOP, this helps you to make your code cleaner:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F1LveZVx.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.imgur.com%2F1LveZVx.png" alt="TypeScript Interface Example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pretty simple, isn't? Tell me what you think about the interfaces? Tell me in the comment section your thoughts and see you next time.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Vue Composition API reactivity out-of-the-box</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Tue, 12 May 2020 17:24:37 +0000</pubDate>
      <link>https://dev.to/manuelojeda/vue-composition-api-reactivity-out-of-the-box-34h</link>
      <guid>https://dev.to/manuelojeda/vue-composition-api-reactivity-out-of-the-box-34h</guid>
      <description>&lt;p&gt;One of the features that Vue Core Team promises us from the upcoming Vue 3 is the reactivity out of the box and this is possible thanks to the freshly new Composition API proposed from &lt;a href="https://www.youtube.com/watch?v=WLpLYhnGqPA"&gt;Evan You&lt;/a&gt;. But you may be wondering how is this possible? I'll teach you a basic example on how you can use this feature using the OOP paradigm.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the project
&lt;/h2&gt;

&lt;p&gt;Firstly let's create a new basic project from the Vue CLI just to have a quick project in our hands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vue create basic-reactivity-project
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And select the first option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;default(babel, eslint)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Once the project is created let's install Vue Composition API plugin using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd basic-reactivity-project
npm install --save @vue/composition-api
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After the instalation, open your project in you text editor of your preference, in my case with VS Code.&lt;/p&gt;

&lt;p&gt;Open up the &lt;code&gt;src/main.js&lt;/code&gt; and add Composition API into your Vue project, your file should looks like this:&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="nx"&gt;Vue&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;vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;CompApi&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;@vue/composition-api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- We need to import it just after Vue import&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&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;./App.vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="nx"&gt;Vue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CompApi&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// And use it like a normal plugin&lt;/span&gt;

&lt;span class="nx"&gt;Vue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;productionTip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Vue&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;render&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nx"&gt;$mount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#app&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;The setup is now ready!&lt;/p&gt;

&lt;h2&gt;
  
  
  Building up a basic Class
&lt;/h2&gt;

&lt;p&gt;Let's create a basic Class inside &lt;code&gt;src/classes&lt;/code&gt; named Foo.js and inside the file make you to put this code:&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;ref&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;@vue/composition-api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// We just need to add the ref Reactivity system from Composition API&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Foo&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//Normal property using a OOP approach&lt;/span&gt;

  &lt;span class="kd"&gt;constructor&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Foo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Initialize the variable using the ref from Vue&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// This getter function goes into our component and we need to pass the bar property inside an object to make this possible&lt;/span&gt;
  &lt;span class="nx"&gt;getter&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="na"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// This method is only for example to see that the reactivity works&lt;/span&gt;
  &lt;span class="nx"&gt;handleForm&lt;/span&gt;&lt;span class="p"&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bar&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="nx"&gt;Foo&lt;/span&gt;

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



&lt;h2&gt;
  
  
  Preparing the App.vue as a Composition API component
&lt;/h2&gt;

&lt;p&gt;We need to make some few changes to make sure the component uses this new API, so let's change the code with 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;template&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;"app"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;v-model=&lt;/span&gt;&lt;span class="s"&gt;"form.bar"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="na"&gt;click=&lt;/span&gt;&lt;span class="s"&gt;"handleForm"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Click me&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class="c1"&gt;// We need to call the ref once again to make sure the reactivity works in our component&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;defineComponent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onMounted&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;@vue/composition-api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;FooClass&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;./classes/FooClass&lt;/span&gt;&lt;span class="dl"&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;defineComponent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;setup&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// This const will receive the object from the class&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;({})&lt;/span&gt;

    &lt;span class="c1"&gt;// The class wrapper&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;FooClass&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;// Just a handler&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleForm&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="c1"&gt;// Calling the handler from the class&lt;/span&gt;
      &lt;span class="nx"&gt;service&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleForm&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nx"&gt;onMounted&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="c1"&gt;// Here is where the magic happends, we set the value into the form variable from the Foo class&lt;/span&gt;
      &lt;span class="nx"&gt;form&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;=&lt;/span&gt; &lt;span class="nx"&gt;service&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getter&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="nx"&gt;form&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nx"&gt;handleForm&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="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And with this we have the project ready, and we need to run: &lt;code&gt;npm run serve&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Previewing the results
&lt;/h2&gt;

&lt;p&gt;If we followed this guide, we should see in our browser the next image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sZ794uoN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/rNLMTOa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sZ794uoN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/rNLMTOa.png" alt="The result from or build"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we type in the input we can see the normal reactivity works as intended, but if you press in &lt;strong&gt;Click me&lt;/strong&gt; we can see that this property works too inside the class, and will show us the actual value without passing the value in any function created from the class, the Reactivity works outside of Vue!!!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZMQVB-J3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/qvj4Zrs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZMQVB-J3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/qvj4Zrs.png" alt="Reactivity outside of Vue component"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since I saw this possibility my mind melted, so I ask to you, are you interested in what is coming in Vue 3? Let's talk about it in the comment section.&lt;/p&gt;

&lt;p&gt;You can check this project in this repo: &lt;a href="https://github.com/manuelojeda/vue-out-of-the-box"&gt;https://github.com/manuelojeda/vue-out-of-the-box&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>vue</category>
      <category>webdev</category>
      <category>oop</category>
    </item>
    <item>
      <title>Typescript: Basic types</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Sat, 02 May 2020 01:37:03 +0000</pubDate>
      <link>https://dev.to/manuelojeda/typescript-basic-types-3cmp</link>
      <guid>https://dev.to/manuelojeda/typescript-basic-types-3cmp</guid>
      <description>&lt;p&gt;As we saw in the first entry of this series why is important to consider TypeScript in your development, we are going to check the features needed to understand how this JavaScript superset works. In this entry we are going to learn what are the most basic types in TypeScript, which they are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Boolean&lt;/li&gt;
&lt;li&gt;Number&lt;/li&gt;
&lt;li&gt;String&lt;/li&gt;
&lt;li&gt;Array&lt;/li&gt;
&lt;li&gt;Any&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/docs/handbook/basic-types.html"&gt;and many more...&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Booleans
&lt;/h2&gt;

&lt;p&gt;This is the most basic type which is onlt two values possible: &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;. How to declare a boolean type? Pretty ease actually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;myFlag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;span class="c1"&gt;// After doing this you can make all the usual uses for a boolean variable, with the only difference that you can't redeclare the type value as we saw before.&lt;/span&gt;

&lt;span class="nx"&gt;myFlag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;true&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="c1"&gt;// TypeSciprt will alert that this is impossible because myFlag is a boolean type and not an string type&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Number
&lt;/h2&gt;

&lt;p&gt;As the name says, this is a number type that can assign: integers, floating point, hexadecimal, decimal, octal and binaries values. By assigning the number type, if you are using VS Code you can access into all the functions and methods available to the number type thanks to the Intellisense feature.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cl5zH8dt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8skjczq9774y8ya5iukf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cl5zH8dt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8skjczq9774y8ya5iukf.png" alt="Number type variable"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  String
&lt;/h2&gt;

&lt;p&gt;String types are the usual variables to use a paragraph, URL, etc, values given into our variable. We can set an string type by using &lt;code&gt;'&lt;/code&gt;, &lt;code&gt;""&lt;/code&gt; and &lt;strong&gt;string literals&lt;/strong&gt;. Which the string template we can use variables inside as we usually do in JavaScript (a demostration that TypeScript is still JavaScript).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yFl3ew_w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/b3q7r4tpmcrx53vh7sw0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yFl3ew_w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/b3q7r4tpmcrx53vh7sw0.png" alt="String type variable"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array
&lt;/h2&gt;

&lt;p&gt;Arrays are a particular case in TypeScript because there two ways to declare an array variable. To set this type we need have to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// We can set this variable like this:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myArray&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="nx"&gt;or&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myArray&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And we can access all the functions available for the array type:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MZ4A01k1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kvv898qge5i4z2wub7q6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MZ4A01k1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kvv898qge5i4z2wub7q6.png" alt="Array type variable"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This particular type is special because if we declare an array of type as we can see at the previous example, we can't add another value type into the array, and if you try, Intellisense will alert you that is forbidden:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yTNS4lr7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1gw4uu8111rkf3a3c8e5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yTNS4lr7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1gw4uu8111rkf3a3c8e5.png" alt="Adding a wrong type into an array"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9SvChbcW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5fzsbtx11dkh6ueohia7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9SvChbcW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5fzsbtx11dkh6ueohia7.png" alt="Intellisense wrong type alert"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Any
&lt;/h2&gt;

&lt;p&gt;This is a very special type because this one can make all the previous types available, like if were using normal JavaScript. We can set a number type and later change it into a boolean type and so on, so be careful to use this type because this one release one of the security features from TS. Also, if you set an array of &lt;strong&gt;any&lt;/strong&gt; types you can add wharever you want into the array without any restriction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WvsKsx0i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3r5vj7rsn7c05y3my3j4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WvsKsx0i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3r5vj7rsn7c05y3my3j4.png" alt="The infamous any type"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we can see, the Intellisense from VSCode didn't alert me by changing the value of an any var, of by adding any var type into the array.&lt;/p&gt;

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

&lt;p&gt;As we saw in this post, declaring a type isn't hard to do and is a helpful feature within the development. In my personal point of view this can saves you from doing a mistake during the development of a product. I know a professional JavaScript dev won't make that mistake but we aren't excent from doing a mistake, so if we can have this can of help, is a welcome one. I invite you to join into TypeScript, you will enjoy learning this beautiful JavaScript super power.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Why use TypeScript for web development?</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Wed, 29 Apr 2020 00:57:40 +0000</pubDate>
      <link>https://dev.to/manuelojeda/why-use-typescript-for-web-development-264a</link>
      <guid>https://dev.to/manuelojeda/why-use-typescript-for-web-development-264a</guid>
      <description>&lt;h1&gt;
  
  
  Why use TypeScript for web development?
&lt;/h1&gt;

&lt;p&gt;In the recent years there is a debate between if JavaScript needs or not the typing being a standard in the code. If we see the &lt;a href="https://2019.stateofjs.com/javascript-flavors/"&gt;State of JS (JavaScript Flavors)&lt;/a&gt;, TypeScript has gained a lot of popularity in the recent years giving at least 50+% of devs users being happy and determinated to use this superset of JavaScript in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is TypeScript?
&lt;/h2&gt;

&lt;p&gt;Typescript borns from Microsoft as an extension of JavaScript which main objective is adding the type support to JavaScript.&lt;br&gt;
Let's be clear, TypeScript isn't another new language you need to learn, is still JavaScript but with superpower following the EcmaScript standard, so don't need to be worried if your code won't work or not in a old broswer.&lt;/p&gt;

&lt;p&gt;Let's think in the next example&lt;/p&gt;
&lt;h2&gt;
  
  
  Some basic TypeScript
&lt;/h2&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;span class="c1"&gt;// some code later&lt;/span&gt;

&lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.1416&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// more code needed but it wont get in and your app is broken now&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;As you see we have a &lt;code&gt;foo&lt;/code&gt; const with a &lt;strong&gt;boolean&lt;/strong&gt; value but for some ready you change it into a &lt;strong&gt;number&lt;/strong&gt;, after that your app is broken because a condition needed it won't work after that change and can be unnoticed (every one of us suffered for this), so, what is TypeScript adding to avoid this issue? Let's find out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// We add the value type by adding : after the var name, in this case is &amp;lt;varName&amp;gt;: &amp;lt;type&amp;gt;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;span class="c1"&gt;// some code later&lt;/span&gt;

&lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.1416&lt;/span&gt;
&lt;span class="c1"&gt;// here TypeScript will alert you saying that you can't assign a number type value into a boolean type, of course we need to remove this line to successfully continue developing&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// your code will be executed safely!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  So, what TypeScript offers?
&lt;/h3&gt;

&lt;p&gt;Of course is not only about typing but we can say is one of the biggest features, TS has a lot of features that makes your project modular and easy to maintain, and I can say with all certain no neccesity of adding too much documentation into the code because is almost self explained.&lt;/p&gt;

&lt;p&gt;TypeScript offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic Types (number, boolean, string, array, etc)&lt;/li&gt;
&lt;li&gt;Interfaces&lt;/li&gt;
&lt;li&gt;OOP Classes&lt;/li&gt;
&lt;li&gt;Generics (this one is super powerful that we are going to check in a future post)&lt;/li&gt;
&lt;li&gt;Enums&lt;/li&gt;
&lt;li&gt;and many more&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you wants to learn TypeScript you can check the &lt;a href="https://www.typescriptlang.org/docs/home.html"&gt;documentation&lt;/a&gt; and there are some many platforms teaching you how to TypeScript like &lt;a href="https://www.pluralsight.com/"&gt;PluralSight&lt;/a&gt; and &lt;a href="https://www.platzi.com"&gt;Platzi (for spanish speakers)&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Pass Laravel data into a Vue component without using any HTTP request</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Tue, 21 Apr 2020 22:37:20 +0000</pubDate>
      <link>https://dev.to/manuelojeda/pass-laravel-data-into-a-vue-component-without-using-any-http-request-c3j</link>
      <guid>https://dev.to/manuelojeda/pass-laravel-data-into-a-vue-component-without-using-any-http-request-c3j</guid>
      <description>&lt;p&gt;As you know, passing information between the backend and the frontend we usually make some HTTP request to fetch that data into our application (Vue, Angular, React, VanillaJs, etc) and that add an extra load time in rendering initially our app.&lt;br&gt;
If you are a Laravel and Vue dev we have some good news, you can pass data between your Laravel Controller and the Vue component without doing any initial HTTP request by following some easy steps.&lt;/p&gt;
&lt;h2&gt;
  
  
  Preparing the project
&lt;/h2&gt;

&lt;p&gt;Let assume you have a fresh new Laravel project, in case you haven't just run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;laravel new vue-basic
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After we have our project ready we need to run one more command to have the posibility to add the frontend without any complication and using the recommended guidelines from &lt;strong&gt;Laravel&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;composer&lt;/span&gt; &lt;span class="n"&gt;require&lt;/span&gt; &lt;span class="n"&gt;laravel&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="n"&gt;ui&lt;/span&gt;

&lt;span class="c1"&gt;// the run this one to add Vue into our project:&lt;/span&gt;
&lt;span class="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;ui&lt;/span&gt; &lt;span class="n"&gt;vue&lt;/span&gt;

&lt;span class="c1"&gt;// And finally run&lt;/span&gt;
&lt;span class="n"&gt;npm&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Getting some basic stuff from our controller
&lt;/h2&gt;

&lt;p&gt;For this example let's make a basic example using &lt;a href="http://docs.guzzlephp.org/en/stable/"&gt;Guzzle/HTTP&lt;/a&gt; which is the HTTP Client Laravel is using with the latest version, I know at the title I said without doing a HTTP request but for this example i'm using an API to get some data but this works perfectly if you are fetching data from your database using Eloquent, and i'm using the well known &lt;a href="https://rickandmortyapi.com/"&gt;Rick n Morty API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Create a controller using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// No other flag is needed&lt;/span&gt;
&lt;span class="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;controller&lt;/span&gt; &lt;span class="n"&gt;BasicController&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After that invoke the Http request file here&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Http\Controllers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;Illuminate\Http\Request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;Illuminate\Support\Facades\Http&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;--- This line is needed for this example&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BasicController&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;Controller&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now we need to create our function that will be connected into our route, in this case i'll use an &lt;strong&gt;index&lt;/strong&gt; function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Code goes here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now we need to retrieve our data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Fetching the Rick n Morty data here, we need to convert it into json to get the response from the server&lt;/span&gt;
  &lt;span class="nv"&gt;$api_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Http&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'https://rickandmortyapi.com/api/character/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Then we send our data to the view&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;view&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'home'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'api_data'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$api_data&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;A this point our controller should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;App\Http\Controllers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;Illuminate\Http\Request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;Illuminate\Support\Facades\Http&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;BasicController&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Fetching the Rick n Morty data here, we need to convert it into json to get the response from the server&lt;/span&gt;
    &lt;span class="nv"&gt;$api_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Http&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'https://rickandmortyapi.com/api/character/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="s1"&gt;'results'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

    &lt;span class="c1"&gt;// Then we send our data to the view&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;view&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'welcome'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'api_data'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$api_data&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;h2&gt;
  
  
  Building a basic Vue component
&lt;/h2&gt;

&lt;p&gt;We need to create a component that will be the one responsible to get the data from our view blade.php file. To this go into &lt;code&gt;/&amp;lt;project_root&amp;gt;/resources/js/components/&lt;/code&gt; and create a component with any name you want to give, in my case will be &lt;code&gt;Basic.vue&lt;/code&gt;, then add the next code into your newly created component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight vue"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Add a v-for cycle to show the retrieved data --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt;
        &lt;span class="na"&gt;v-for=&lt;/span&gt;&lt;span class="s"&gt;"character in apiData"&lt;/span&gt;
        &lt;span class="na"&gt;:key=&lt;/span&gt;&lt;span class="s"&gt;"character.id"&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="si"&gt;{{&lt;/span&gt;&lt;span class="nx"&gt;character&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}}&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;script&lt;/span&gt;&lt;span class="nt"&gt;&amp;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="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Basic&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;apiData&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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="nt"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="k"&gt;script&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

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



&lt;p&gt;And don't forget to call this component at &lt;code&gt;app.js&lt;/code&gt; adding this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Vue&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;basic-component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./components/Basic.vue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and run &lt;code&gt;npm run watch&lt;/code&gt;, we need to have the development mode activated to see the data at the component in our browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting everything
&lt;/h2&gt;

&lt;p&gt;Now that we have our controller and component ready let's connect everything. First we need to connect in our route file the controller we made before&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;Illuminate\Support\Facades\Route&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'BasicController@index'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then we go into our &lt;strong&gt;welcome.blade.php&lt;/strong&gt; and rebuild the html code 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="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"{{ str_replace('_', '-', app()-&amp;gt;getLocale()) }}"&lt;/span&gt;&lt;span class="nt"&gt;&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;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Laravel&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;"app"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="c"&gt;&amp;lt;!-- Magic happens here! --&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;basic-component&lt;/span&gt; &lt;span class="na"&gt;:api-data=&lt;/span&gt;&lt;span class="s"&gt;"{{$api_data}}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/basic-component&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&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;"{{ asset('js/app.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;If we followed this post correctly we will have something like this in our display:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AMZihw1a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/I2ilN7t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AMZihw1a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/I2ilN7t.png" alt="Api data"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if we check in the Vue Dev Tools we will have all data ready to be handle as needed, and no any extra step required to have this possible without using &lt;strong&gt;Axios&lt;/strong&gt; or &lt;strong&gt;Fetch&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4OowMM8w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Yab6XV6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4OowMM8w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Yab6XV6.png" alt="Vue Dev Tools"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here we are, our small example is done. What do you think in this way in getting information from Laravel Controller without using any HTTP Request needed? I hope this help you in the future, and&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kAvv1ib0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://static.gearslutz.com/board/imgext.php%3Fu%3Dhttp%253A%252F%252Fimages.memes.com%252Fmeme%252F878226%26h%3D29d637c6783b72ba5c7f9c81878b2765" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kAvv1ib0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://static.gearslutz.com/board/imgext.php%3Fu%3Dhttp%253A%252F%252Fimages.memes.com%252Fmeme%252F878226%26h%3D29d637c6783b72ba5c7f9c81878b2765" alt="Wash your hands"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>php</category>
      <category>laravel</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Vue 3.0 Beta released</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Thu, 16 Apr 2020 20:02:15 +0000</pubDate>
      <link>https://dev.to/manuelojeda/vue-3-0-beta-released-f0i</link>
      <guid>https://dev.to/manuelojeda/vue-3-0-beta-released-f0i</guid>
      <description>&lt;p&gt;Today the Vue Team released the beta for the 3.0 version, you can check out the release changelog here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/vuejs/vue-next/releases/tag/v3.0.0-beta.1" rel="noopener noreferrer"&gt;https://github.com/vuejs/vue-next/releases/tag/v3.0.0-beta.1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: Evan remarked to don't use this version in production or critical apps yet!&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1250875642830303233-823" src="https://platform.twitter.com/embed/Tweet.html?id=1250875642830303233"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1250875642830303233-823');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1250875642830303233&amp;amp;theme=dark"
  }



 &lt;/p&gt;

</description>
      <category>vue</category>
    </item>
    <item>
      <title>Setup your VSCode as PHP code editor/IDE</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Fri, 21 Feb 2020 21:19:31 +0000</pubDate>
      <link>https://dev.to/manuelojeda/setup-your-vscode-as-php-code-editor-ide-46g1</link>
      <guid>https://dev.to/manuelojeda/setup-your-vscode-as-php-code-editor-ide-46g1</guid>
      <description>&lt;p&gt;As you know &lt;strong&gt;VSCode&lt;/strong&gt; became a so popular text editor which can be tuned up to any language development (JavaScript, C, C#, Java, Go, Python and many more). In this post we are going to setup one of the popular backend language, I'm talking about PHP.&lt;/p&gt;

&lt;h3&gt;
  
  
  Requirements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/"&gt;VSCode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;PHP&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pear.php.net/package/PHP_CodeSniffer"&gt;PHP Code Sniffer&lt;/a&gt; installed&lt;/li&gt;
&lt;li&gt;&lt;a href="https://getcomposer.org/"&gt;Composer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are a Windows user, you can skip installing PHP and Composer in a single step using &lt;a href="https://laragon.org/"&gt;Laragon&lt;/a&gt;, in case you are Linux/MacOS you can follow this guide: &lt;a href="https://dev.to/manuelojeda/setup-a-php-dev-enviroment-with-laravel-valet-and-wsl-1pp6"&gt;https://dev.to/manuelojeda/setup-a-php-dev-enviroment-with-laravel-valet-and-wsl-1pp6&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you have installed all the things mentioned, I suggest you to install this extension in your VSCode:&lt;/p&gt;

&lt;h4&gt;
  
  
  Settings Sync
&lt;/h4&gt;

&lt;p&gt;This one will let you bring your VSCode configuration anywhere you need it, only vinculate your GitHut account and you are ready to go:&lt;br&gt;
&lt;a href="https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync"&gt;https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After having all of this installed let is begin with the dance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Settings at VSCode
&lt;/h3&gt;

&lt;p&gt;First of all, let's tell VSCode where is the PHP Path is. Go to &lt;strong&gt;Settings&lt;/strong&gt; and type &lt;strong&gt;php&lt;/strong&gt; at the search bar, then look for the section; &lt;strong&gt;PHP › Validate: Executable Path&lt;/strong&gt; then click in &lt;strong&gt;Edit in settings.json&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f7Bxwrzw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xs7icezwlm7xme6kfet8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f7Bxwrzw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xs7icezwlm7xme6kfet8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have opened, look of the line that it says: "php.validate.executablePath". If you have it, make sure your php installation path is there, in case you haven't add this rule to your settings.json:&lt;/p&gt;

&lt;p&gt;In Linux and Mac should be:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"php.validate.executablePath": "/usr/bin/php"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In Windows should be:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"php.validate.executablePath": "c:/Program Files/php/php.exe"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After doing this preparation you are ready to install and make your VSCode be ready to do some PHP code, let's roll!&lt;/p&gt;

&lt;h3&gt;
  
  
  Extensions
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense"&gt;PHP IntelliSense&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;What this extension does is giving some help depending on what version of PHP you have installed (at least PHP 7) giving you the autocompletition that Intellisense do in Visual Studio.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=MehediDracula.php-namespace-resolver"&gt;PHP Namespace Resolver&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;This is extension give you the posibility to auto add a Class from another file with few steps and without the necessity of tiping it at the beginning of your PHP file:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i9syPgbp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/upEGtPa.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i9syPgbp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/upEGtPa.gif" alt="Example on how PHP Namespace Resolver works"&gt;&lt;/a&gt;&lt;br&gt;
Credtis to the author: &lt;strong&gt;Mehedi Hassan&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=ikappas.phpcs#review-details"&gt;phpcs&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;This extension linter you code and tells you what you need to have an overall standar for a PHP code made. Follow up the installation guide and enjoy having a PHP linter in VSCode.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=onecentlin.laravel-blade"&gt;Laravel Blade Snippets&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;This extension gives you some helpful snippets when you are coding some blade files for the views of Laravel.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://marketplace.visualstudio.com/items?itemName=ikappas.composer"&gt;Composer&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;This provides an interface to manage your Composer dependencies and validates your &lt;strong&gt;composer.json&lt;/strong&gt; config file&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;With these extensions your PHP development will be boosted greatly and make Visual Studio Code a great free alternative in the market. I hope this post was helpul to you and I wish to you good luck in the path.&lt;/p&gt;

</description>
      <category>php</category>
      <category>vscode</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Moving to Ubuntu. A Windows developer point of view</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Mon, 10 Feb 2020 21:42:18 +0000</pubDate>
      <link>https://dev.to/manuelojeda/moving-to-ubuntu-a-windows-developer-point-of-view-pom</link>
      <guid>https://dev.to/manuelojeda/moving-to-ubuntu-a-windows-developer-point-of-view-pom</guid>
      <description>&lt;p&gt;Hi guys, in this post I wanted to share with you my development experience from a Windows point of view and, why I decided to move to Linux (Ubuntu).&lt;/p&gt;

&lt;h3&gt;
  
  
  Prologue
&lt;/h3&gt;

&lt;p&gt;I being developing since 2015 using Windows as a primary OS. Normally I do some development of &lt;strong&gt;PHP&lt;/strong&gt; Web App's, and as some of you know, doing PHP in Windows can be a kind of tedious. Started using the old &lt;strong&gt;WAMPP&lt;/strong&gt;, then moved to &lt;strong&gt;XAMP&lt;/strong&gt; and so on until I started doing Laravel with &lt;a href="https://laragon.org/"&gt;Laragon&lt;/a&gt; apps since at the end 2017.&lt;/p&gt;

&lt;p&gt;In my experience Windows is such a great OS (Windows 10 is such a complete OS that let you do a lot of stuff, even using Linux with WSL, I'll board that point later), of course is intended for mainstream use, common uses like listening music, watching movies, doing some paperwork with Office, etc. etc. But at as developer can be a little tedious setting a proper development enviroment, since installing the right tool, seeking a proper compatibility with the Operative System etc etc.&lt;/p&gt;

&lt;p&gt;After some point you can make this possible, you have installed what you need but then the main Windows issue comes to life, the OS starts being too slow, the startup takes too much time, of course you can solve this installing an SSD which is common at this time but before at 2015's was a new thing in the hardware topic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Windows 10 and WSL comes to the searchlight
&lt;/h3&gt;

&lt;p&gt;As I mentioned before, Windows 10 came with a lot of great thing as a developer, the developer experience got a new life, why? Because Microsoft did the unthinkable, added Linux support with WSL (Windows Subsystem for Linux) but once again the performance over time degrades at that point this can be slower than using the native OS.&lt;/p&gt;

&lt;p&gt;The main problem with WSL is that sometimes trend to freeze when executing a task, since a simple &lt;code&gt;npm install &amp;lt;something&amp;gt;&lt;/code&gt; can take more time that doing it native (&lt;strong&gt;Windows&lt;/strong&gt; or &lt;strong&gt;Linux&lt;/strong&gt;). Also, some PHP extensions can't be used in Windows because there is no working approach, this happened to me after started working with a Laravel project that was developed using Ubuntu, found out that a specific &lt;strong&gt;PHP&lt;/strong&gt; extension was needed and there is no Windows solution for that.&lt;/p&gt;

&lt;p&gt;So then I started using &lt;strong&gt;Laravel Valet WSL&lt;/strong&gt;, &lt;a href="https://dev.to/manuelojeda/setup-a-php-dev-enviroment-with-laravel-valet-and-wsl-1pp6"&gt;you can check an installation guide here&lt;/a&gt; and the development was fluid, no problem at all, just some server restart after starting the WSL when you recently started up your PC because you get a 502 error that can be fixed using &lt;code&gt;valet restart&lt;/code&gt;. But the freezing keep coming sometime along. So decided to try a native Linux approach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Decided to try Ubuntu
&lt;/h3&gt;

&lt;p&gt;After meditating a lot of time I decided to move to Ubuntu, I was using Ubuntu WSL version for 1 year long and I had the confidence to move into a new Operative System since I was using the Ubuntu CLI and lost the fear we have most of the time using Linux. Yes, that fear that make you think you can break something using the Linux Console Bash, and if you break something, there is no problem, at least you learned something from that.&lt;/p&gt;

&lt;p&gt;The only thing I had to be careful was not to destroy the Windows installation in my workstation. I'm using a PC that became with a preinstalled Windows 10 and with one HDD only, so my fear was if the Windows install became rogue, with my luck and &lt;a href="https://www.tecmint.com/install-ubuntu-alongside-with-windows-dual-boot/"&gt;this tutorial&lt;/a&gt; there was no problem at all.&lt;/p&gt;

&lt;p&gt;Then started installing everything I needed to start developing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP 7.2&lt;/li&gt;
&lt;li&gt;&lt;a href="https://laravel-news.com/valet-for-ubuntu-linux"&gt;Laravel Valet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;ZSH&lt;/li&gt;
&lt;li&gt;etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I noticed a bigger performance, more efficient installation and didn't take too much setting my development enviroment (maximun 3 hours) and I was amazed with this result. But of course you may ask, what happens with all the Windows products that doesn't works in Linux?&lt;/p&gt;

&lt;p&gt;There are &lt;strong&gt;Adobe XD&lt;/strong&gt; alternatives, you can try anoter approches like &lt;a href="https://www.figma.com/"&gt;Figma&lt;/a&gt; which is a great UI design tool. Or &lt;a href="https://www.gimp.org/"&gt;GIMP&lt;/a&gt; as a Photoshop alternative, this one is pretty powerfull.&lt;/p&gt;

&lt;p&gt;I give you an invitation to try Linux (doesn't matter what distro did you choose), it will give you a great developer experience and performance, also doesn't need too much resources from your computer, which is nice now a day.&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>linux</category>
      <category>windows</category>
      <category>php</category>
    </item>
    <item>
      <title>JetBrains Mono: A free and open source typeface for developers</title>
      <dc:creator>Manuel Ojeda</dc:creator>
      <pubDate>Thu, 16 Jan 2020 17:18:52 +0000</pubDate>
      <link>https://dev.to/manuelojeda/jetbrains-mono-a-free-and-open-source-typeface-for-developers-233f</link>
      <guid>https://dev.to/manuelojeda/jetbrains-mono-a-free-and-open-source-typeface-for-developers-233f</guid>
      <description>&lt;p&gt;Today the team from JetBrains release a new Mono font named &lt;strong&gt;JetBrains Mono&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can check the font right here: &lt;a href="https://www.jetbrains.com/lp/mono/"&gt;https://www.jetbrains.com/lp/mono/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
