Posts for Prince Chukwudire

Driven JavaScript Enthusiast, keen on pixel perfect implementation of UI designs centered on good user experience.

npm run serve vs npm run dev in vuejs

In this guide, you will understand the driving mechanisms behind the two commands npm run serve vs npm run dev in vuejs npm run serve is basically asking the package manager (npm) to run the command specified under the name serve in the package.json file. The same goes for the npm run dev command. It […]

March 6, 2021 in Code examples

Using the Vue.nextTick function

In this article, you will learn about the Vue.nextTick callback function and when to make use of it. In plain terms, Vue.nextTick gives you access to the data instance after it has been updated, the new changes effected on the DOM but not yet rendered on the web page. We can visualize its role by […]

March 4, 2021 in Code examples

Using the @click directive in Vue

In this article, you will learn how to use the @click directive to handle events in vue. It is worthy of note, that the @click directive is similar to v-on:click event handler. lets assume we have a method that logs a simple message to the console. We can trigger this function by using the @click […]

March 4, 2021 in Code examples

Axios Delete Example

In this article, you will learn how to make a delete request using Axios. Let’s assume we have an array of objects containing a list of users, a list we probably have gotten from an endpoint. A simple delete call to delete the first object would look like thus:

March 3, 2021 in Code examples

Using the V-cloak directive in Vue

in this article, you will learn how to use the V-cloak directive in Vue. In simple terms, the v-cloak directive is used to hide an element while vue is mounting; it works best with a CSS property. Here is a basic instance of using the directive: we first declare a property in our css that […]

March 3, 2021 in Code examples

Using Spread Operators In Javascript

In this article, you will learn how to use spread operators in JavaScript. The spread operator basically allows iterable operations such as an array or object to be expanded in other places. Say we have two Arrays array1 and array2 We can use spread operators to merge the two arrays: Aside merging the two arrays […]

March 2, 2021 in Code examples

Fix ‘Unknown Custom Element’ in vue

In this article, you will learn how to register components locally and globally, to avoid the ‘unknown custom element error‘. Global Registration: Global registration of components is achieved using the Vue.component directive. This gives us access to make use of our component in any component. Local Registration: We can also register our components locally by […]

March 2, 2021 in Errors solved

Vue Created Vs Mounted lifecycle Hook

In this article, you will learn when to make use of the Created vs Mounted vue life cycle. Created: During the created life cycle hook, the data instance is done with processing the options available. However, you do not have access to the DOM at this point. Mounted: During the mounted life cycle hook, the […]

March 2, 2021 in Code examples

Using forEach method in Vue

In this article, you will learn how to use the forEach method in vue. In general, the forEach method runs a provided method once for each element in the array. A simple forEach method in vue can be done in vue like so: Here data is a property in our instance. This can also be […]

March 2, 2021 in Code examples

Validate Phone number Inputs in HTML5

In this article, you will learn how to validate a phone number input using HTML5.Input elements of type tel allow a user to input telephone digits. What it however doesn’t provide, is validation to a particular format. To achieve the said validation, we can use the pattern attribute which allows us to slot in Regular […]

March 2, 2021 in Code examples

Compare Objects in lodash

In this article, you will learn how to compare objects in lodash. Lodash is basically a JavaScript library that provides utility functions for functional programming. Comparing objects with lodash can be achieved using the _.isEqual method. Here’s how: This returns false if objects are different.

March 2, 2021 in Code examples