<?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: Chidinma Nwosu</title>
    <description>The latest articles on DEV Community by Chidinma Nwosu (@chidinma_nwosu).</description>
    <link>https://dev.to/chidinma_nwosu</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%2F1615814%2F66364963-8625-4d82-8d91-9f4258219a28.jpg</url>
      <title>DEV Community: Chidinma Nwosu</title>
      <link>https://dev.to/chidinma_nwosu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chidinma_nwosu"/>
    <language>en</language>
    <item>
      <title>Javascript vs Typescript: The Battle of Frontend Technologies.</title>
      <dc:creator>Chidinma Nwosu</dc:creator>
      <pubDate>Sat, 29 Jun 2024 11:06:32 +0000</pubDate>
      <link>https://dev.to/chidinma_nwosu/javascript-vs-typescript-the-battle-of-frontend-technologies-2fbl</link>
      <guid>https://dev.to/chidinma_nwosu/javascript-vs-typescript-the-battle-of-frontend-technologies-2fbl</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
I have always been fascinated about how things work, imagine my surprise when i started learning about frontend technologies and development. I got to see how websites and applications were built from start to near finish. These websites and applications looked so intricate, interactive and virtually stunning, knowing that they were just 'bare bones' before they got to that point still amazes me. We will be looking at frontend technologies and we will be juxtaposing two of those technologies for better understanding. Before that:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;br&gt;
You will need knowledge of the following concepts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;how the web works.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTML&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CSS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic Javascript&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is a Frontend Technology?&lt;/strong&gt;&lt;br&gt;
Frontend technology are those tools, frameworks, libraries, and languages used to create the user interface (UI) and user experience (UX) of a web application or website. This covers everything that users interact with directly in their web browsers, including layouts, designs, graphics, text, and interactive elements.&lt;br&gt;
Here are a list of those various frontend technologies and a brief description about them:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Languages&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML"&gt;HTML (Hyper Text Markup Language)&lt;/a&gt;&lt;/strong&gt;: is the most basic building block of the Web. It is a markup language used to define the meaning and structure of web content.
 &lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FCSS"&gt;CSS (Cascading Style Sheets)&lt;/a&gt;&lt;/strong&gt;: Used to describe the presentation and layout of web pages. It describes how elements or content should be rendered on screen, on paper, in speech, or on other media.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FJavaScript"&gt;JavaScript&lt;/a&gt;&lt;/strong&gt;: A programming language that is used to add interactivity to a web application or website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fwww.typescriptlang.org%2F"&gt;TypeScript&lt;/a&gt;&lt;/strong&gt;: A superset of JavaScript that adds static typing to the language, improving code quality and maintainability.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Frameworks and Libraries&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/r/?url=http%3A%2F%2Freact.dev"&gt;&lt;strong&gt;React&lt;/strong&gt;&lt;/a&gt; : A JavaScript library for building user interfaces, maintained by Facebook.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fv17.angular.io%2F"&gt;&lt;strong&gt;Angular&lt;/strong&gt;&lt;/a&gt;: A platform and framework for building single-page client applications using HTML and TypeScript, maintained by Google.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fvuejs.org%2F"&gt;&lt;strong&gt;Vue.js&lt;/strong&gt;&lt;/a&gt;: A progressive JavaScript framework used to build user interfaces and single-page applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fsvelte.dev%2F"&gt;&lt;strong&gt;Svelte&lt;/strong&gt;&lt;/a&gt;: A modern JavaScript framework that compiles components into highly efficient imperative code that directly manipulates the DOM.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fwww.emberjs.com%2F"&gt;&lt;strong&gt;Ember.js&lt;/strong&gt;&lt;/a&gt;: A framework for creating ambitious web applications by providing a comprehensive solution that includes everything from routing to state management.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fbackbonejs.org%2F"&gt;&lt;strong&gt;Backbone.js&lt;/strong&gt;&lt;/a&gt;: A lightweight JavaScript library that provides the minimal structure needed for web applications by including models, views, collections, and routers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;CSS Preprocessors and Frameworks&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sass (Syntactically Awesome Stylesheets)&lt;/strong&gt;: A CSS preprocessor that allows you to use variables, nested rules, mixins, and more, to keep your stylesheets well-organized and easy to maintain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Less&lt;/strong&gt;: Another CSS preprocessor that extends CSS with dynamic behavior such as variables, mixins, and functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fgetbootstrap.com%2F"&gt; &lt;strong&gt;Bootstrap&lt;/strong&gt;&lt;/a&gt;: A popular CSS framework that provides a collection of CSS and JavaScript tools for creating responsive and mobile-first web projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Ftailwindcss.%20com"&gt;&lt;strong&gt;Tailwind CSS&lt;/strong&gt;&lt;/a&gt;: A utility-first CSS framework for rapidly building custom user interfaces.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bulma&lt;/strong&gt;: A modern CSS framework based on Flexbox.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Build Tools and Module Bundlers&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Webpack&lt;/strong&gt;: A module bundler that takes modules with dependencies and generates static assets representing those modules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gulp&lt;/strong&gt;: A task runner that uses Node.js streams to automate tasks such as minification, compilation, and testing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Grunt&lt;/strong&gt;: A JavaScript task runner that automates repetitive tasks like minification, compilation, and linting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Parcel&lt;/strong&gt;: A fast, zero-configuration web application bundler.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Package Managers&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;npm (Node Package Manager)&lt;/strong&gt;:The default package manager for Node.js, used to install and manage JavaScript packages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Yarn&lt;/strong&gt;: A package manager that doubles down as project manager, used for managing project dependencies.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Version Control&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Git&lt;/strong&gt;: A distributed version control system for tracking changes in source code during software development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: A web-based platform that uses Git for version control and provides a collaborative environment for developers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Testing Tools&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Jest&lt;/strong&gt;: A delightful JavaScript testing framework with a focus on simplicity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mocha&lt;/strong&gt;: A JavaScript test framework running on Node.js, featuring browser support, asynchronous testing, and more.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chai&lt;/strong&gt;: A BDD/TDD assertion library for Node.js and the browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cypress&lt;/strong&gt;: A next-generation front end testing tool built for the modern web.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Selenium&lt;/strong&gt;: A portable framework for testing web applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Code Editors and IDEs&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Visual Studio Code&lt;/strong&gt;: A free, open-source code editor developed by Microsoft.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sublime Text&lt;/strong&gt;: A sophisticated text editor for code, markup, and prose.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Atom&lt;/strong&gt;: A hackable text editor for the 21st century, developed by GitHub.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WebStorm&lt;/strong&gt;: A powerful IDE for modern JavaScript development by JetBrains.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Understanding and mastering these frontend technologies can significantly enhance your ability to build robust, interactive, and visually appealing web applications. As a beginner, always start with the basics - HTML, CSS, and JavaScript before moving on to more advanced frameworks and tools. Going further, we will be looking at the differences between Javascript and Typescript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Javascript vs Typescript: A beginner's guide&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JavaScript (JS) and TypeScript (TS) are both essential technologies for frontend development. Understanding their similarities and differences is crucial for building robust, interactive, and visually appealing web applications and sites.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Javascript?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JavaScript&lt;/em&gt; is a programming language that is widely used for web development to create interactive elements within web browsers. It is used to manipulate the DOM, handle events, create animations, and make asynchronous requests (AJAX) to servers. JavaScript is dynamically typed; meaning variable types are determined at runtime, which offers great flexibility but can lead to errors that are hard to debug. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, world!&lt;/span&gt;&lt;span class="dl"&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pervasive/Ubiquity&lt;/strong&gt;: Javascript is supported by all modern web browsers. It can be used on all modern web browsers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Community&lt;/strong&gt;: Javascript has a large community with plenty of libraries and frameworks (like React, Angular, Vue).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Versatile&lt;/strong&gt;: Javascript can be used for both client-side and server-side (Node.js) programming.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Error-Prone&lt;/strong&gt;: Javascript is dynamically typed. Dynamic typing can lead to runtime errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Complexity&lt;/strong&gt;: As projects grow, maintaining JavaScript code can become complex without proper structure and discipline.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What is Typescript?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;TypeScript&lt;/em&gt; is a superset of JavaScript that adds static typing and other features to the language. It is designed to develop large applications and transcompiles to JavaScript. TypeScript introduces static types, which allows developers to catch errors at compile-time rather than runtime. For 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, world!&lt;/span&gt;&lt;span class="dl"&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Type Safety&lt;/strong&gt;: Catches type-related errors during development, reducing runtime errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Readability&lt;/strong&gt;: Improves code readability and maintainability with type annotations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tooling&lt;/strong&gt;: Better support for modern IDEs with autocompletion, refactoring, and navigation.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disadvantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Learning Curve&lt;/strong&gt;: Requires learning new concepts if you're coming from JavaScript.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compilation&lt;/strong&gt;: Needs to be compiled to JavaScript, adding an extra build step.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What are the differences between Javascript and Typescript&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Typing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JavaScript&lt;/em&gt; is dynamically typed which means that the data type of a variable is determined during runtime. This flexibility can sometimes lead to unexpected errors. Conversely, &lt;em&gt;TypeScript&lt;/em&gt; is statically typed which ensures that the data type of a variable is determined at compile time, making TypeScript codes safer and less prone to errors. TypeScript sometimes requires explicit type definitions or uses type inference.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Javascript-this code is expects a number as a value, but a string is passed, but Javascript has no issues with it because it is a valid code.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// TypeScript-will throw an error because the type is number.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Error checking and handling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JavaScript&lt;/em&gt;, as a dynamically typed language, only detects errors at runtime, which can lead to runtime failures that are harder to debug. &lt;em&gt;TypeScript&lt;/em&gt;, being a statically typed language, catches errors during the compile time, making it easier to identify and fix issues early in the development cycle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compilation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JavaScript&lt;/em&gt; code is executed directly by web browsers or Node.js without the need for prior compilation. In contrast, &lt;em&gt;TypeScript&lt;/em&gt; code must be compiled into JavaScript before it can be executed, which adds an extra step in the development process while enhancing code reliability and error checking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tooling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JavaScript&lt;/em&gt;, while powerful, does not inherently provide all the necessary tooling for modern development, as it has evolved developers have created list of tools to improve the development process. &lt;em&gt;TypeScript&lt;/em&gt; offers enhanced tooling capabilities such as autocompletion, better tooling, type checking and safety, improved code and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Development Experience&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JavaScript&lt;/em&gt; is faster to write due to less strict rules, and is suitable for quick prototyping. &lt;em&gt;TypeScript&lt;/em&gt; on the other hand, may take more time upfront but it results in more robust and maintainable code, especially for large-scale applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use cases&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JavaScript&lt;/em&gt; is good for quick Prototyping, like when you need to quickly test ideas and build small applications. It is well-suited for small to medium-sized projects due to its simplicity and flexibility. &lt;em&gt;Typescript&lt;/em&gt; on the other hand is used for large projects. It is used when working on large codebases where maintainability and readability are key. It is also also used for team projects or in teams, to ensure consistent code quality and prevent type-related bugs. Many modern frameworks like Angular use TypeScript, and using it can enhance the development experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbtylkmwcgkd2wnrj1aii.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbtylkmwcgkd2wnrj1aii.png" alt="Difference between Javascript and Typescript" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My Journey with HNG…&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At HNG, React is the Framework(frontend technology)used extensively, React is a Javascript framework that is used to build fast and interactive user interfaces, it is also efficient and flexible. The ability to integrate React with other technologies and frameworks means that it can adapt to a wide range of things, from simple web applications to complex applications. It was first developed by Facebook in 2011.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is HNG?&lt;/strong&gt;&lt;br&gt;
HNG is a global internship program that focuses on training young individuals in software development. Participants are given real-world projects to work on and are mentored by industry professionals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does the HNG Internship program works?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is my first experience with HNG and i am exhilarated because i will be challenging myself , so it is both exhilarating and daunting opportunity at the same time. I am also a bit new to React but i have built a couple of things with it. I am looking forward to contributing in no little way to the growth of HNG using the little knowledge i have of React, while also improving on my React skills. I expect to become a part of a team, contribute actively on that team, collaborate with others, build upon my existing knowledge and skills, among other things. Back to how the HNG internship works, To relive your curiosity visit &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fhng.tech%2Finternship"&gt;HNG Internship&lt;/a&gt; and &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fhng.tech%2Fhire"&gt;HNG Hire&lt;/a&gt; for more information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, most times we are plagued with making a choice, picking between one thing or the other. For instance, picking between Angular or Vue, Visual Studio code or Sublime text, Javascript or Typescript. I hope what i am about to say next answers one of your questions, both JavaScript and TypeScript have their place in web development. JavaScript is great for its simplicity and flexible nature, making it ideal for small projects and quick prototyping.- While TypeScript with its static typing and enhanced tooling, is better suited for larger, complex projects and team environments. As a beginner, starting with JavaScript provides a solid foundation, and learning TypeScript can be a natural progression to writing more reliable and maintainable code. &lt;em&gt;Does this answer your question?&lt;/em&gt; &lt;em&gt;Will you play around with both Javascript and Typescript?&lt;/em&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>learning</category>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Navigating Success: Setting up Vue Router in your Project.</title>
      <dc:creator>Chidinma Nwosu</dc:creator>
      <pubDate>Fri, 14 Jun 2024 14:42:05 +0000</pubDate>
      <link>https://dev.to/chidinma_nwosu/navigating-success-setting-up-vue-router-in-your-project-4el0</link>
      <guid>https://dev.to/chidinma_nwosu/navigating-success-setting-up-vue-router-in-your-project-4el0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
In the ever-growing tech space of today, a seamless navigation experience can either make or break your web application. That is why our journey begins with understanding Vue and the Vue router. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Vue ?&lt;/strong&gt;&lt;br&gt;
&lt;a href="//vuejs.org"&gt;Vue&lt;/a&gt; also pronounced as 'view', was created by &lt;a href="https://evanyou.me/"&gt;Evan You&lt;/a&gt;. Vue is an open-source, Front-end, Javascript framework for building user interfaces and Single Page Applications(SPA). It builds an application on top of HTML, CSS and Javascript. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a Vue Router ?&lt;/strong&gt;&lt;br&gt;
A vue router  is the official router for vue.js. It is a guide that transforms a Single Page Application(SPA) into a dynamic multi-page application. It integrates with vue to make building a Single Page Applications(SPA) and navigating through it a walk in the park.&lt;/p&gt;

&lt;p&gt;This story follows Chidinma, a passionate front-end developer, as she embarks on a mission to set up a vue router in her latest project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Challenge&lt;/strong&gt;&lt;br&gt;
Staring at the project requirements on my screen; a modern day application with multiple pages and dynamic navigation. The challenge was clear: to set up a single page application with a robust routing system to multiple pages. Without it, users would be lost , unable to explore the different sections of my application seamlessly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Discovering the solution&lt;/strong&gt;&lt;br&gt;
In my quest for a solution, I came across the vue router, an official library for vue.js, designed to handle seamless navigation, as explained under the definition of a vue router. The promise of a clean, declarative routing, and the ability to handle nested routes was intriguing! I just knew that this was the key to unlocking the multi-page potential of my project. Now, let us delve into the key features of vue-router i discovered along the way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the key features of the vue router?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are some key features that vue-router has that makes it unique. These features are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Nested route mapping&lt;/strong&gt; : vue-router allows for nested routes, which means you can have routes within routes.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamic routing&lt;/strong&gt;: it allows you change your applications route on the fly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Component-based router configuration&lt;/strong&gt; : it allows you structure your routes in a component-based manner. This makes routing configuration easier to manage as the application grows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Customizable scroll behavior&lt;/strong&gt; : it lets you customize the scroll behavior of your application when navigating between routes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Navigation control&lt;/strong&gt; :it gives you control over navigation, allowing you to programmatically navigate to different routes in response to user actions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Route params, Query and Wildcards&lt;/strong&gt; : it supports route parameters, query parameters, and wildcards, giving you control over how your application responds to different URLs.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now that we have an idea of what vue is, who founded it, what the vue-router is and some key features of the vue-router, we can now delve into setting up a vue-router in our project. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step by step implementation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The steps involved in setting up a vue-router in a project is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Folder/file structure&lt;/strong&gt;: properly understanding the folder and file structure of our project is important . First, we have a diagrammatic representation of our file structure and secondly, we have an explanation of the structure.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-vue-project/
├── node_modules/
├── public/
│   ├── favicon.ico
│   └── index.html
├── src/
│   ├── assets/
│   │   └── logo.png
│   ├── components/
│   │   └── HelloWorld.vue
│   ├── router/
│   │   └── index.js
│   ├── views/
│   │   ├── HomeView.vue
│   │   ├── AboutView.vue
│   │   └── NotFoundView.vue
│   ├── App.vue
│   ├── main.js
│   └── router
│       └── index.js
├── .gitignore
├── babel.config.js
├── jsconfig.json
├── package.json
├── README.md
└── vue.config.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Explanation of the folder/file structure&lt;/strong&gt;&lt;br&gt;
A. &lt;strong&gt;Root Directory&lt;/strong&gt; (my-vue-project/): it contain several folders(the forward-slash(/) indicates that it is a folder) and files, as explained below. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;node_modules/&lt;/strong&gt;: Contains all the npm packages installed for the project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;public/&lt;/strong&gt;: Contains static assets and the main HTML file (index.html).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;src/&lt;/strong&gt;: The source directory where all the Vue components, assets, and configuration files reside.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;assets/&lt;/strong&gt;: For static assets such as images, fonts, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;components/&lt;/strong&gt;: Contains reusable Vue components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;router/&lt;/strong&gt;: Contains the router configuration file (index.js).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;views/&lt;/strong&gt;: Contains Vue components that are used as views/pages in the application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;App.vue&lt;/strong&gt;: The root Vue component.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;main.js&lt;/strong&gt;: The entry point of the application where Vue instance is created and mounted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;store/&lt;/strong&gt;: (If using Vuex) Contains the Vuex store configuration for state management.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.gitignore&lt;/strong&gt;: Specifies which files and directories should be ignored by Git.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;babel.config.js&lt;/strong&gt;: Babel configuration file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;jsconfig.json&lt;/strong&gt;: JavaScript configuration file for the project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;package.json&lt;/strong&gt;: Lists the project's dependencies and scripts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;README.md&lt;/strong&gt;: A markdown file providing information about the project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;vue.config.js&lt;/strong&gt;: Optional configuration file for Vue CLI.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.After creating a vue project(my-vue-project),understanding its folder and file structure. We then install the vue-router using npm, and set up the vue-router in our existing project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install vue-router@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.In our project, we will have a folder called &lt;strong&gt;View&lt;/strong&gt;, it may contain some files(HomeView.vue and AboutView.vue). Additional view files are welcome, as seen in the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script setup&amp;gt;
// In your folder called View, setup vue components that will be used as view, three files in it(HomeView.vue, AboutView.vue, and NotFoundView.vue)
&amp;lt;/script&amp;gt;

&amp;lt;!--HomeView.vue--&amp;gt;
&amp;lt;template&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h1&amp;gt;Home&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;This is the home page&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&amp;lt;!--AboutView.vue--&amp;gt;
&amp;lt;template&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h1&amp;gt;About&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;This is the about page&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&amp;lt;!--NotFoundView.vue--&amp;gt;
&amp;lt;template&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h1&amp;gt;Not found&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;This is the 404 page&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.In our &lt;strong&gt;App.vue&lt;/strong&gt;, under your &lt;strong&gt;src folder&lt;/strong&gt;, import &lt;strong&gt;Router Link and Router View&lt;/strong&gt;, use them to define your navigation routes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script setup&amp;gt;
import {routerLink,routerView} from 'vue-router'
&amp;lt;/script&amp;gt;

&amp;lt;!--create a navigation bar with links to the home, about, and not found pages--&amp;gt;
&amp;lt;template&amp;gt;
   &amp;lt;nav&amp;gt;
        &amp;lt;RouterLink to="/"&amp;gt;Home&amp;lt;/routerLink&amp;gt;
        &amp;lt;RouterLink to="/about"&amp;gt;About&amp;lt;/routerLink&amp;gt;
        &amp;lt;RouterLink to="/not-found"&amp;gt;Not found&amp;lt;/routerLink&amp;gt;
    &amp;lt;/nav&amp;gt;
    &amp;lt;!-- this is the view where each components will be rendered --&amp;gt;
    &amp;lt;RouterView/&amp;gt;
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.In our &lt;strong&gt;routes folder&lt;/strong&gt;, under our &lt;strong&gt;index.js file&lt;/strong&gt;, create your router instance by importing createWebHistory and createRouter, putting your routes in an array, making sure each route is an object that contains a path, name, component, and maybe some meta details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {createRouter, createWebHistory } from 'vue-router'
import HomeView from './HomeView.vue'

//create a route instance using VueRouter
const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
    {
        path: '/',
        name: 'Home',
        component: HomeView,
        meta: {
            title: 'Home',
            description: 'This is the home page'
        }
    },
      {
        path: '/about',
        name: 'About',
        component:()=&amp;gt;import('./AboutView.vue'),//allows for lazy loading
        meta: { //meta is used for search engine optimization
             title: 'About',
             description: 'This is the about page'
         }
    },
    {
        path: '/:catchAll(.*)',
        name: 'not-found',
        component:()=&amp;gt;import('./NotFoundView.vue'),
        meta: {
            title: 'Not found',
            description: 'This is the 404 page'
        }
    }
]
})

export default router;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice that the &lt;strong&gt;AboutView&lt;/strong&gt; and &lt;strong&gt;NotFoundView&lt;/strong&gt; sections of the route file use a different value for the component option, which differs from the &lt;strong&gt;HomeView&lt;/strong&gt;. &lt;strong&gt;Why is that the case?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is because we are lazy loading these pages. Lazy loading of routes in Vue Router is a technique used to increase the performance of a Vue.js application by splitting the application into smaller chunks that are loaded on demand. Instead of loading all routes upfront, lazy loading loads the JavaScript for a route only when that route is visited. This can significantly reduce the initial load time of the application and improve the user experience, especially for large applications with many routes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does lazy loading works?&lt;/strong&gt;&lt;br&gt;
Lazy loading in Vue Router uses dynamic import statements to load route components asynchronously, as seen in the code example. When a user navigates to a route, the corresponding component is fetched from the server and then rendered.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is meta, why is it used in routes?&lt;/strong&gt;&lt;br&gt;
If you look closely at our code example above, you will notice that all our routes have a meta property, &lt;em&gt;Why?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In vue router, the meta property is used to attach metadata to routes, this metadata can be used for various purposes: search engine optimization, authentication, authorization, page titles etc. It simply aids and eases navigation.&lt;/p&gt;

&lt;p&gt;6.Finally, in the &lt;strong&gt;src folder&lt;/strong&gt;, under the &lt;strong&gt;main.js file&lt;/strong&gt;, you need to inject your router into your vue instance for it to work.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const app = createApp(App)
app.use(router)
app.mount('#app')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the magic of the vue router comes to life, after refreshing the application, with a click we can seamlessly navigate through the HomeView, AboutView and NotFoundView pages of our application, by simply clicking on links or entering URLs such as /, /about, and /not-found(*) in your browser, you can access the respective pages without needing to refresh the application.  Thereby enhancing user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
In conclusion, keep in mind that this is just a basic setup, it will vary from project to project. Also,  vue-router has many other features like nested routes, named routes, and programmatic navigation that is not shown here but you can try on your own, just for fun. For more information, read up on the &lt;a href="//router.vuejs.org"&gt;vue router&lt;/a&gt;. You need to realize that the journey of setting up a vue-router involves creating a seamless user experience that guides users through your application effortlessly, always bear this in mind. &lt;/p&gt;

&lt;p&gt;Using the vue router, I was able to transform a static project into a dynamic, multi-page application. This story shows that with the right tool, proper understanding of vue, vue router, its key features, folder and file structure of your project, among other things, we can create a seamless navigation experience for a user, through our application. &lt;em&gt;Isn't that wonderful? Would you like to try it out?&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
      <category>vue</category>
    </item>
  </channel>
</rss>
