Svelte Reactivity

In Svelte you can listen for changes in the component state, and update other variables. For example if you have a count variable: and you update it by clicking a button: You can listen for changes on count using the special syntax $: which defines a new block that Svelte will re-run when any variable referenced into it changes. Here’s an… Continue reading Svelte Reactivity

Handling State in Svelte

Every component, in addition to defining the markup, the CSS and the JavaScript logic, can host its own state. What is state? State is any data that’s needed to make the component render what it’s rendering. For example, if a form input field has the string “test” written into it, there’ll be a variable somewhere holding… Continue reading Handling State in Svelte

The Higher Order Components.

When do we need a Higher Order Component?While developing React applications, we might develop components that are quite similar to each other with minute differences.In most cases, developing similar components might not be an issue but, while developing larger applications we need to keep our code DRY, therefore, we want an abstraction that allows us to define this… Continue reading The Higher Order Components.

The keys in React JS

The ‘React Way’ to render a List Use Array.Map Not a For Loop Give Each Item in Unique Key. Avoid using Array Index As the Key A key is a special string attribute that needs to be included when using lists of elements. Example Importance of keysKeys help react identify which elements were added, changed… Continue reading The keys in React JS

The different ways to style a React component.

There are many different ways through which one can style a React component. Some of the ways are : Inline StylingWe can directly style an element using inline style attributes.Make sure the value of style is a JavaScript object: Using JavaScript objectWe can create a separate JavaScript object and set the desired style properties.This object… Continue reading The different ways to style a React component.

The differences between functional and class components

The functional components were called stateless components and were behind class components on feature basis. After the introduction of Hooks, functional components are equivalent to class components.Although functional components are the new trend, the react team insists on keeping class components in React. Therefore, it is important to know how these both components differ.On the… Continue reading The differences between functional and class components

Handle Routing in React Apps with React Router

What is React-Router Many modern websites are actually made up of a single page, they just look like multiple pages because they contain components which render like separate pages. These are usually referred to as SPAs – single-page applications. At its core, what React Router does is conditionally render certain components to display depending on the route being used… Continue reading Handle Routing in React Apps with React Router

Passing Data Between a Parent and Child in React JS

There are two directions a data can go and it’s the following: From parent to child From child to parent Passing Data From Parent to Child When you need to pass data from a parent to child class component, you do this by using props. For example, let’s say you have two class components, Parent and Child, and you… Continue reading Passing Data Between a Parent and Child in React JS

All the fundamental React.js concepts

React is all about components React is designed around the concept of reusable components. You define small components and you put them together to form bigger components. All components small or big are reusable, even across different projects. A React component — in its simplest form — is a plain-old JavaScript function: Note the following… Continue reading All the fundamental React.js concepts

Svelte 3 – How to integrate with svelte routing

Svelte routes options Sapper is a framework that helps you to build web applications and is powered by Svelte, so what does mean this? That you only need to install Sapper and you have a bunch of functionalities including routing. svelte-routing, This is a declarative Svelte routing library, and this one is the library that we will use… Continue reading Svelte 3 – How to integrate with svelte routing