<?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>Forem: MINI JAIN</title>
    <description>The latest articles on Forem by MINI JAIN (@mini2809).</description>
    <link>https://forem.com/mini2809</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%2F472314%2F23d7b490-d9eb-4769-b7d9-6c824716cfee.jpeg</url>
      <title>Forem: MINI JAIN</title>
      <link>https://forem.com/mini2809</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mini2809"/>
    <language>en</language>
    <item>
      <title>Mastering Maven: Beyond Build Management</title>
      <dc:creator>MINI JAIN</dc:creator>
      <pubDate>Mon, 15 Jul 2024 18:12:27 +0000</pubDate>
      <link>https://forem.com/mini2809/mastering-maven-beyond-build-management-6fd</link>
      <guid>https://forem.com/mini2809/mastering-maven-beyond-build-management-6fd</guid>
      <description>&lt;p&gt;Maven is widely known as a powerful build automation tool, but it’s much more than that. It’s a comprehensive project management tool that simplifies the entire build process, dependency management, and documentation generation. In this post, we will explore various aspects of Maven and understand its capabilities in detail.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Key Features of Maven&lt;/em&gt;&lt;br&gt;
1.Build Generation&lt;br&gt;
2.Dependency Management&lt;br&gt;
3.Documentation&lt;/p&gt;

&lt;p&gt;When you execute commands like mvn build or mvn deploy, Maven looks into the pom.xml file, which contains all the configurations, and acts accordingly. Let’s dive deeper into the pom.xml structure and its significance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The POM File&lt;/strong&gt;&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;project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&amp;gt;
    &amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;

    &amp;lt;!-- Basic project information --&amp;gt;
    &amp;lt;groupId&amp;gt;com.example&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;my-app&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.0-SNAPSHOT&amp;lt;/version&amp;gt;
    &amp;lt;packaging&amp;gt;jar&amp;lt;/packaging&amp;gt;

    &amp;lt;!-- Properties --&amp;gt;
    &amp;lt;properties&amp;gt;
        &amp;lt;maven.compiler.source&amp;gt;1.8&amp;lt;/maven.compiler.source&amp;gt;
        &amp;lt;maven.compiler.target&amp;gt;1.8&amp;lt;/maven.compiler.target&amp;gt;
        &amp;lt;spring.version&amp;gt;5.2.8.RELEASE&amp;lt;/spring.version&amp;gt;
    &amp;lt;/properties&amp;gt;

    &amp;lt;!-- Dependencies --&amp;gt;
    &amp;lt;dependencies&amp;gt;
        &amp;lt;!-- Spring Core --&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-core&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
        &amp;lt;/dependency&amp;gt;
        &amp;lt;!-- Spring Context --&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-context&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
        &amp;lt;/dependency&amp;gt;
        &amp;lt;!-- JUnit for testing --&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;junit&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;junit&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;4.12&amp;lt;/version&amp;gt;
            &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;
    &amp;lt;/dependencies&amp;gt;

    &amp;lt;!-- Build configuration --&amp;gt;
    &amp;lt;build&amp;gt;
        &amp;lt;plugins&amp;gt;
            &amp;lt;!-- Compiler plugin --&amp;gt;
            &amp;lt;plugin&amp;gt;
                &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;maven-compiler-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;3.8.1&amp;lt;/version&amp;gt;
                &amp;lt;configuration&amp;gt;
                    &amp;lt;source&amp;gt;${maven.compiler.source}&amp;lt;/source&amp;gt;
                    &amp;lt;target&amp;gt;${maven.compiler.target}&amp;lt;/target&amp;gt;
                &amp;lt;/configuration&amp;gt;
            &amp;lt;/plugin&amp;gt;
            &amp;lt;!-- Surefire plugin for running tests --&amp;gt;
            &amp;lt;plugin&amp;gt;
                &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;maven-surefire-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;2.22.2&amp;lt;/version&amp;gt;
            &amp;lt;/plugin&amp;gt;
        &amp;lt;/plugins&amp;gt;
    &amp;lt;/build&amp;gt;

    &amp;lt;!-- Repositories --&amp;gt;
    &amp;lt;repositories&amp;gt;
        &amp;lt;repository&amp;gt;
            &amp;lt;id&amp;gt;central&amp;lt;/id&amp;gt;
            &amp;lt;url&amp;gt;https://repo.maven.apache.org/maven2&amp;lt;/url&amp;gt;
        &amp;lt;/repository&amp;gt;
    &amp;lt;/repositories&amp;gt;

    &amp;lt;!-- Distribution management for deployment --&amp;gt;
    &amp;lt;distributionManagement&amp;gt;
        &amp;lt;repository&amp;gt;
            &amp;lt;id&amp;gt;releases&amp;lt;/id&amp;gt;
            &amp;lt;url&amp;gt;http://repo.mycompany.com/releases&amp;lt;/url&amp;gt;
        &amp;lt;/repository&amp;gt;
        &amp;lt;snapshotRepository&amp;gt;
            &amp;lt;id&amp;gt;snapshots&amp;lt;/id&amp;gt;
            &amp;lt;url&amp;gt;http://repo.mycompany.com/snapshots&amp;lt;/url&amp;gt;
        &amp;lt;/snapshotRepository&amp;gt;
    &amp;lt;/distributionManagement&amp;gt;

&amp;lt;/project&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Lets decode th POM file:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;**The pom.xml's file follows a specific XML schema  (defined in xsi:schemaLocation:)that ensures it adheres to a correct structure, which Maven verifies.The schema here refers to defininfg the pom,For example When I am adding dependencies, I should have groupid, artifactId,version. I cannot add something xyz as key.These type of rules defined are taken from xsi:schemaLocation&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Elements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Parent POM:&lt;br&gt;
Each POM file in Spring Boot has a parent POM. If no parent is defined, the super POM becomes the parent. Every Pom is a subset of Super pom.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;GroupId, ArtifactId, and Version:&lt;br&gt;
These elements uniquely identify a project in Maven Central.Lets say If I have deployed my project in maven central,these 3 properties will uniquely identify my project.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;groupId&amp;gt;com.example&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;my-app&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.0-SNAPSHOT&amp;lt;/version&amp;gt;
    &amp;lt;packaging&amp;gt;jar&amp;lt;/packaging&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Properties:
Define key-value pairs that can be referenced throughout the pom.xml.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;properties&amp;gt;
    &amp;lt;java.version&amp;gt;1.8&amp;lt;/java.version&amp;gt;
&amp;lt;/properties&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can use &lt;code&gt;${java.version}&lt;/code&gt; as variable throughout in the pom.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repositories:
Specify where to download dependencies, typically from Maven Central.The url value defines where to get the dependencies and start downloading.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;repositories&amp;gt;
    &amp;lt;repository&amp;gt;
        &amp;lt;id&amp;gt;central&amp;lt;/id&amp;gt;
        &amp;lt;url&amp;gt;https://repo.maven.apache.org/maven2&amp;lt;/url&amp;gt;
    &amp;lt;/repository&amp;gt;
&amp;lt;/repositories&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dependencies: List the project's dependencies.&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;dependencies&amp;gt;
    &amp;lt;dependency&amp;gt;
        &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;spring-boot-starter-web&amp;lt;/artifactId&amp;gt;
        &amp;lt;version&amp;gt;2.3.4.RELEASE&amp;lt;/version&amp;gt;
    &amp;lt;/dependency&amp;gt;
&amp;lt;/dependencies&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Build Configuration:
Defines the build process and phases.
For this to we need to understand the build lifecycle of maven.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Maven Build Life cycle&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Maven follows a specific build lifecycle that consists of several phases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Validate:
Validates the project structure.When we want to add certain standards and conventions before building and packaging,We can define a plugin for validations. The command for triger validate is: &lt;code&gt;mvn validate&lt;/code&gt;
The Maven Checkstyle Plugin helps you check if your Java source code adheres to a specified coding standard.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;project&amp;gt;
    &amp;lt;!-- other configurations --&amp;gt;

    &amp;lt;build&amp;gt;
        &amp;lt;plugins&amp;gt;
            &amp;lt;plugin&amp;gt;
                &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;maven-checkstyle-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;3.1.1&amp;lt;/version&amp;gt;
                &amp;lt;executions&amp;gt;
                    &amp;lt;execution&amp;gt;
                        &amp;lt;id&amp;gt;checkstyle-validation&amp;lt;/id&amp;gt;
                        &amp;lt;goals&amp;gt;
                            &amp;lt;goal&amp;gt;check&amp;lt;/goal&amp;gt;
                        &amp;lt;/goals&amp;gt;
                       {% embed  &amp;lt;phase&amp;gt;validate&amp;lt;/phase&amp;gt; %}
                    &amp;lt;/execution&amp;gt;
                &amp;lt;/executions&amp;gt;
                &amp;lt;configuration&amp;gt;
                    &amp;lt;configLocation&amp;gt;config/checkstyle/checkstyle.xml&amp;lt;/configLocation&amp;gt;
                    &amp;lt;encoding&amp;gt;UTF-8&amp;lt;/encoding&amp;gt;
                    &amp;lt;consoleOutput&amp;gt;true&amp;lt;/consoleOutput&amp;gt;
                    &amp;lt;failsOnError&amp;gt;true&amp;lt;/failsOnViolation&amp;gt;true&amp;lt;/failsOnWarning&amp;gt;false&amp;lt;/failsOnSuppressedViolations&amp;gt;false&amp;lt;/failsOnNoViolations&amp;gt;false
                    &amp;lt;linkXRef&amp;gt;false&amp;lt;/linkXRef&amp;gt;
                &amp;lt;/configuration&amp;gt;
            &amp;lt;/plugin&amp;gt;
        &amp;lt;/plugins&amp;gt;
    &amp;lt;/build&amp;gt;

&amp;lt;/project&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here I am adding checklist validation in validate phase.It will validate all the goals written in checklist validate.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Compile:&lt;br&gt;
Converts Java code to bytecode (.class files) and places them in the target/classes folder. The command will be &lt;code&gt;mvn compile&lt;/code&gt;.(It internally do javac.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test: &lt;br&gt;
Runs test cases located in the test/ directory.The command is &lt;code&gt;mvn test&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Package: &lt;br&gt;
Generates JAR/WAR files from the compiled bytecode and stores them in the target/ folder.The command is &lt;code&gt;mvn package&lt;/code&gt;.We cxan even share the jar whcih can be used as dependency to other project or we can deploy&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify: &lt;br&gt;
Checks the integrity of the package.The command is &lt;code&gt;mvn verify&lt;/code&gt;.Here we can perform integration test and other checks.&lt;br&gt;
Ex: Maven PMD plugin.PMD is a source code analyser.It checks for unused variables, unused imports, duplicate code, empty catch blocks etc and reports a warning.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;plugin&amp;gt;
                &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;maven-pmd-plugin&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;3.15.0&amp;lt;/version&amp;gt;
                &amp;lt;executions&amp;gt;
                    &amp;lt;execution&amp;gt;
                        &amp;lt;id&amp;gt;pmd-validation&amp;lt;/id&amp;gt;
                        &amp;lt;goals&amp;gt;
                            &amp;lt;goal&amp;gt;check&amp;lt;/goal&amp;gt;
                        &amp;lt;/goals&amp;gt;
                        &amp;lt;phase&amp;gt;verify&amp;lt;/phase&amp;gt;
                    &amp;lt;/execution&amp;gt;
                &amp;lt;/executions&amp;gt;
                &amp;lt;configuration&amp;gt;
                    &amp;lt;printFailingErrors&amp;gt;true&amp;lt;/printFailingErrors&amp;gt;
                    &amp;lt;failOnViolation&amp;gt;true&amp;lt;/failOnViolation&amp;gt;
                &amp;lt;/configuration&amp;gt;
            &amp;lt;/plugin&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install:&lt;br&gt;
Installs the package in the local repository.The command is &lt;code&gt;mvn install&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploy:&lt;br&gt;&lt;br&gt;
Uploads the package to a remote repository.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Customizing the Build Process:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Maven provides flexibility to add specific goals in each phase through the  element. You can create your own plugin or can use inbuilt plugins to extend Maven’s functionality. We have added PMD in verify phase and checkstyle validation in validate phase.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Install with maven: *&lt;/em&gt;&lt;br&gt;
It installs the jar file we created in compile phase after completing test,package and verify.&lt;br&gt;
here it creates a m2 folder in which all the dependencies are kept. We can change this folder location from settings.xml under &lt;br&gt;
&lt;code&gt;&amp;lt;localrepository&amp;gt;&amp;lt;/localrepository&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploying with Maven&lt;/strong&gt;&lt;br&gt;
Deployment configuration is specified inside the  element.&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;distributionManagement&amp;gt;
    &amp;lt;repository&amp;gt;
        &amp;lt;id&amp;gt;internal.repo&amp;lt;/id&amp;gt;
        &amp;lt;url&amp;gt;http://repo.mycompany.com/maven2&amp;lt;/url&amp;gt;
    &amp;lt;/repository&amp;gt;
&amp;lt;/distributionManagement&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tip: we can provide credentials in settings.xml inside .m2/repository folder.&lt;/p&gt;

&lt;p&gt;Staying updated with Maven and mastering its nuances can significantly enhance project management and build automation skills. Remember, Maven is more than just a build tool—it's project's command center. Dive deep, explore new plugins, and keep experimenting. The more we engage with Maven, the more powerful our development process becomes. Keep pushing the boundaries and let Maven handle the rest—after all, it's like having a Swiss Army knife for your project management needs!&lt;/p&gt;

&lt;p&gt;Thank you so much for reading,will appreciate your valuable feedback.&lt;br&gt;
Also tell me in the comments if you encounter any cool Plugins.&lt;br&gt;
Dont forget to like,share and susbcribe.&lt;/p&gt;

</description>
      <category>springboot</category>
      <category>mvn</category>
      <category>java</category>
      <category>pom</category>
    </item>
    <item>
      <title>DOM Guardians: Exploring JavaScript’s MutationObserver API</title>
      <dc:creator>MINI JAIN</dc:creator>
      <pubDate>Sun, 09 Jun 2024 17:11:14 +0000</pubDate>
      <link>https://forem.com/mini2809/dom-guardians-exploring-javascripts-mutationobserver-api-29hd</link>
      <guid>https://forem.com/mini2809/dom-guardians-exploring-javascripts-mutationobserver-api-29hd</guid>
      <description>&lt;p&gt;Welcome to the world of JavaScript Observers! If you've ever needed a way to keep an eye on changes in your DOM and react dynamically, then observers are your best friends. Let's break it down.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Exactly Are Observers?&lt;/strong&gt;&lt;br&gt;
As the name suggests, an observer watches for changes or events to occur and then springs into action with a callback function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The MutationObserver API:&lt;/strong&gt;&lt;br&gt;
The MutationObserver API is your go-to tool for detecting changes in the DOM tree of your browser. Here’s how you can set it up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function cb(mutations) {
    // changes as response to mutation
}

// Create a MutationObserver object and pass the callback defined
const observer = new MutationObserver(cb);
observer.observe(targetNode, options);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Configuring Your Observer: The Options&lt;/strong&gt;&lt;br&gt;
To tell your MutationObserver what to watch for, you provide it with a set of options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;childList: Boolean&lt;/li&gt;
&lt;li&gt;attributes: Boolean&lt;/li&gt;
&lt;li&gt;characterData: Boolean&lt;/li&gt;
&lt;li&gt;subtree: Boolean&lt;/li&gt;
&lt;li&gt;attributeFilter: []&lt;/li&gt;
&lt;li&gt;attributesOldValue: Boolean&lt;/li&gt;
&lt;li&gt;characterDataOldValue: Boolean&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Breaking Down the Boolean Functions:&lt;/strong&gt;&lt;br&gt;
1.childList: Monitors the addition or removal of child nodes. When this happens, the mutation observer triggers an event of type childList.&lt;/p&gt;

&lt;p&gt;2.Attributes: Watches for changes to the attributes of a node. Any style change? Boom! The observer triggers an event of type attributes.&lt;/p&gt;

&lt;p&gt;3.CharacterData: Keeps an eye on changes to the innerHTML character data, triggering an event of type characterData.&lt;/p&gt;

&lt;p&gt;These three properties are essential for setting up observers on a target node.&lt;/p&gt;

&lt;p&gt;4.subtree: Observes changes in any part of the subtree of a particular node. While childList monitors only direct children, subtree goes all the way down the rabbit hole to nested children.&lt;/p&gt;

&lt;p&gt;5.attributesOldValue and characterDataOldValue: These properties store the old values, allowing you to compare the changes and deduce what’s different.&lt;/p&gt;

&lt;p&gt;6.attributeFilter: Specify which attributes to monitor changes for, using an array field. This is especially useful when you want to zero in on specific attributes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function cb(mutations) {
    mutations.forEach(mutation =&amp;gt; {
        console.log(mutation);
    });
}

const observer = new MutationObserver(cb);

const options = {
    childList: true,
    attributes: true,
    characterData: true,
    subtree: true,
    attributeFilter: ['class', 'style'],
    attributesOldValue: true,
    characterDataOldValue: true
};

const targetNode = document.getElementById('target');

observer.observe(targetNode, options);

// Remember to disconnect when done
// observer.disconnect();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Always use observer.disconnect() when you’re done observing to prevent memory leaks. &lt;/p&gt;

&lt;p&gt;With this setup, your JavaScript code is now armed with a vigilant observer, ready to react to any changes in your DOM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stay Tuned: More Observers to Come&lt;/strong&gt;&lt;br&gt;
But wait, there’s more! The world of observers doesn’t end here. There are different types of observers that we'll cover in upcoming blogs, each with its unique superpowers. From IntersectionObserver to ResizeObserver, we’ll dive into how these tools can make your web applications even more dynamic and responsive.&lt;/p&gt;

&lt;p&gt;Stay tuned and keep observing!&lt;br&gt;
Also for more detailed examples and code snippets, check out my &lt;a href="https://github.com/mini2809/Observers"&gt;github repository&lt;/a&gt;. Happy coding.&lt;br&gt;
If you have any questions, thoughts, or suggestions, feel free to leave a comment below.Also Have you used MutationObservers in your projects? Share your experiences and tips in the comments!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>mutationobserverapi</category>
      <category>webdev</category>
    </item>
    <item>
      <title>React 19 Launches with Game-Changing React Compiler: What Does This Mean for Your Apps?</title>
      <dc:creator>MINI JAIN</dc:creator>
      <pubDate>Sun, 19 May 2024 09:24:57 +0000</pubDate>
      <link>https://forem.com/mini2809/react-19-launches-with-game-changing-react-compiler-what-does-this-mean-for-your-apps-7dk</link>
      <guid>https://forem.com/mini2809/react-19-launches-with-game-changing-react-compiler-what-does-this-mean-for-your-apps-7dk</guid>
      <description>&lt;p&gt;With the recent launch of React 19 Beta, one of the most exciting features introduced in this release is the React Compiler—a groundbreaking tool that promises to revolutionize the way we build and optimize React applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance Optimization Without the Hassle&lt;/strong&gt;&lt;br&gt;
Unlike traditional approaches where developers have to manually implement optimizations, such as React.memo or useCallback and useMemo hooks, the React Compiler takes care of these optimizations for you. It intelligently analyzes your code and applies the necessary optimizations to ensure your application runs smoothly and efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Adoption&lt;/strong&gt;&lt;br&gt;
Quest Store and Instagram have already begun integrating the React Compiler into their applications. The results have been remarkable, showcasing significant improvements in performance metrics across the board.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Impressive Statistics&lt;/strong&gt;&lt;br&gt;
The introduction of the React Compiler has led to substantial performance gains for both Quest Store and Instagram:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2.5x Faster Interactions: User interactions within the applications have become 2.5 times faster, enhancing the overall user experience.&lt;/li&gt;
&lt;li&gt;12% Improved Initial Load Times: The initial load times of these applications have improved by 12%, ensuring users can start interacting with the apps more quickly.&lt;/li&gt;
&lt;li&gt;Faster Navigation: Navigation between different sections of the apps has become noticeably faster, contributing to a smoother user experience.&lt;/li&gt;
&lt;li&gt;0% Memory Increase: Impressively, these performance improvements have been achieved without any increase in memory usage, maintaining the efficiency of the applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Focus on Business Logic&lt;/strong&gt;&lt;br&gt;
One of the most significant advantages of the React Compiler is that it allows developers to concentrate on writing business logic rather than worrying about performance optimizations. The compiler automatically identifies and implements optimizations, even in areas where developers might not have thought to apply them. This means that developers can write clean, maintainable code while still benefiting from enhanced performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
The introduction of the React Compiler in React 19 Beta marks a significant milestone in the evolution of the React ecosystem. By automating performance optimizations, it streamlines the development process and empowers developers to build high-performance applications with ease. As React 19 gains traction and adoption, we can expect to see even more innovations and enhancements that push the boundaries of what's possible in web development. The future of React is brighter than ever, and the React Compiler is leading the way toward a new era of fast, efficient, and developer-friendly applications.&lt;/p&gt;

&lt;p&gt;Incase if you want to check it out and get your hands dirty refer&lt;br&gt;
&lt;a href="https://react.dev/learn/react-compiler"&gt;https://react.dev/learn/react-compiler&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>react19</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
