<?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: Mathieu Laurent</title>
    <description>The latest articles on DEV Community by Mathieu Laurent (@messenjer).</description>
    <link>https://dev.to/messenjer</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%2F377683%2F349cb206-d558-4d0d-8155-19792ac2bcfa.png</url>
      <title>DEV Community: Mathieu Laurent</title>
      <link>https://dev.to/messenjer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/messenjer"/>
    <language>en</language>
    <item>
      <title>Simplified Debugging : One little gem in the latest version of Vue 3.3</title>
      <dc:creator>Mathieu Laurent</dc:creator>
      <pubDate>Fri, 12 May 2023 12:11:19 +0000</pubDate>
      <link>https://dev.to/messenjer/simplified-debugging-one-little-gem-in-the-latest-version-of-vue-33-4i5i</link>
      <guid>https://dev.to/messenjer/simplified-debugging-one-little-gem-in-the-latest-version-of-vue-33-4i5i</guid>
      <description>&lt;p&gt;The recent release of &lt;a href="https://blog.vuejs.org/posts/vue-3-3"&gt;Vue.js 3.3&lt;/a&gt; has brought a range of new features that significantly enhance the development experience (DX).&lt;/p&gt;

&lt;p&gt;Among them, there is a small powerful improvement: the ability to use &lt;strong&gt;console.log directly in templates&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Previously, using console.log in Vue.js templates would cause this frustrating error 🤯 : &lt;strong&gt;TypeError: Cannot read properties of undefined (reading 'log')&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, Vue.js 3.3 has resolved &lt;a href="https://github.com/vuejs/core/issues/7939"&gt;this issue&lt;/a&gt; by enabling the use of console.log without generating errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use console.log in the template
&lt;/h2&gt;



&lt;div class="highlight js-code-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;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;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&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;count&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="mi"&gt;0&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;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;h1&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="si"&gt;}}&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/h1&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;"console.log(++count)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;++&lt;span class="nt"&gt;&amp;lt;/button&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://play.vuejs.org/#eNp9T0tuwjAQvYrlDaAQu4hdFKL0Ht6AM0BK/JE9oYvId+84QVVEpS7ff2bin96L5wi84nXUoffIIuDoG2V7411ANrEAV5bYNTjDNmTdKKudjci0Gy2yU9a3Hztla7k0UJYAgvHDGYEQY/X90EzTK5FSLQnP/GVEdJa1euj146R4bnYDiMHdtkUx+3eKN0VRy8VKsVr+dvM9X84szdmLr+gsPTLlZvUSouIVm5nM0fkZK35H9LGScrT+cRPaGdmSJgPt9QbKzpn2KI7iILs+4poWEE15Ce47QqBBxferbknkE0IZwHYQIPy79eZd771JfzbzZFI28fQD2YabMw=="&gt;Test the example in the Vue Playground&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now when you click on the button, you will see the value of count in your console 🥳&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mtlQobO8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p553hbwp9m6ld4bq3av8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mtlQobO8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p553hbwp9m6ld4bq3av8.png" alt="A capture of the exemple with the developer console opened" width="521" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>dx</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
