Vue $emit() Method.

Emit a Custom Event There is a need to send information from the component to the parent, and we use the built-in method $emit() to do that. We already have the toggleFavorite method inside the FoodItem.vue component that runs when the toggle button is clicked. Now let’s remove the existing line and add a line to emit our custom event ‘toggle-favorite’:… Continue reading Vue $emit() Method.

Methods vs Computed in Vue ?

What are Methods? Methods in Vue.js are simple JavaScript functions defined within the methods object of a Vue component. They are called directly from the template or within other methods using this keyword. Methods are suitable for performing actions, such as event handling, form submissions, or any other imperative logic. Syntax: export default { data() { return { // data… Continue reading Methods vs Computed in Vue ?

What is Math.abs() in JavaScript function ?

What is Math.abs()? Math.abs() is a built-in JavaScript function that returns the absolute value of a given number. The absolute value of a number is its non-negative value, irrespective of its sign. This means Math.abs() will convert negative numbers to positive numbers, while positive numbers and zero remain unchanged. Syntax javascript Math.abs(x) x: A number… Continue reading What is Math.abs() in JavaScript function ?

GraphQL offers several advantages over traditional RESTful APIs

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables… Continue reading GraphQL offers several advantages over traditional RESTful APIs

JSON.parse() function in JavaScript

The JSON.parse() function in JavaScript is used to parse JSON (JavaScript Object Notation) strings and convert them into JavaScript objects. JSON is commonly used for exchanging data between a web server and a web application. Here’s how JSON.parse() works: Input: It takes a JSON-formatted string as input. Output: It returns a JavaScript object corresponding to… Continue reading JSON.parse() function in JavaScript

Features in React-toastify.

React-toastify is a popular library used for displaying toast notifications in React applications. It offers various features and customization options to enhance the user experience when showing notifications. Below are some key features and capabilities provided by react-toastify: 1. Simple API Easy Integration: react-toastify provides a simple API for displaying toast notifications. You can import… Continue reading Features in React-toastify.

How to Handle Different HTTP Verbs in a Next.js API Route

In a Next.js API route, you can handle different HTTP verbs (methods) such as GET, POST, PUT, DELETE, etc., by using the appropriate request handler functions exported from the file corresponding to your API route. Each HTTP verb corresponds to a specific request handler function that you can export from your API route file. Here’s… Continue reading How to Handle Different HTTP Verbs in a Next.js API Route

What is difference between unescape() and escape() functions in JavaScript?

JavaScript provides two functions for dealing with encoded strings: escape() and unescape(). The escape() function is used to encode a string, making it safe for use in a URL. The unescape() function is used to decode an encoded string. The differences The main difference between the two functions is that escape() encodes characters that are not ASCII, while unescape() only decodes those characters. This means that… Continue reading What is difference between unescape() and escape() functions in JavaScript?

Difference Between MySQL and MariaDB ?

1. MySQL : MySQL is an open-source relational database management system(RDBMS) based on Structured Query Language (SQL). It is developed and managed by oracle corporation and initially released on 23 may, 1995. It is widely being used in many small and large scale industrial applications and capable of handling a large volume of data. After the acquisition… Continue reading Difference Between MySQL and MariaDB ?