<?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: Ashiqur Rahman</title>
    <description>The latest articles on DEV Community by Ashiqur Rahman (@ashiqcseworld).</description>
    <link>https://dev.to/ashiqcseworld</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%2F122077%2Fce62e329-c76e-44a2-906f-cf5e31f8e232.jpeg</url>
      <title>DEV Community: Ashiqur Rahman</title>
      <link>https://dev.to/ashiqcseworld</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ashiqcseworld"/>
    <language>en</language>
    <item>
      <title>Build a MERN stack todo app using react-query</title>
      <dc:creator>Ashiqur Rahman</dc:creator>
      <pubDate>Mon, 19 Oct 2020 16:03:01 +0000</pubDate>
      <link>https://dev.to/ashiqcseworld/build-a-mern-stack-todo-app-using-react-query-59e6</link>
      <guid>https://dev.to/ashiqcseworld/build-a-mern-stack-todo-app-using-react-query-59e6</guid>
      <description>&lt;p&gt;React-query is a Hooks for fetching, caching and updating asynchronous data in React. Many of us use redux or context API to manage our server state (asynchronous state). But What if we stop trying to manage our server state in our frontend code and instead treat it like a cache that just needs to be updated periodically? I think this will make our code more accessible to pure frontend developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fetch Todos
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fetchPosts = async () =&amp;gt; {
  const {
    data: { todos },
  } = await axios.get(`http://localhost:7777/api`);
  return todos;
};

const { data: todos, isLoading, error } = useQuery("tasks", fetchPosts);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see from the above snippet, I give 2 argument on &lt;code&gt;useQuery&lt;/code&gt; where &lt;code&gt;tasks&lt;/code&gt; is the key (we can refetch the data by using that key) and &lt;code&gt;fetchPosts&lt;/code&gt; is the callback function in which I call my express-API.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;useQuery&lt;/code&gt; gives &lt;code&gt;data, isLoading, error&lt;/code&gt; state. It reduces lots of boilerplate code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a todo.
&lt;/h2&gt;

&lt;p&gt;We will create todoItem using &lt;code&gt;useMutation&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Todo form
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form
  className="form"
  onSubmit={(e) =&amp;gt; {
    e.preventDefault();
    mutate({ task: value });
    reset();
  }}
&amp;gt;
  &amp;lt;input
    type="text"
    className="form__box"
    onChange={onChangeHandler}
    name="task"
    value={value}
    placeholder="Enter a task..."
    required
  /&amp;gt;

  &amp;lt;button className="form__button"&amp;gt;Add Task&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;;


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

&lt;/div&gt;



&lt;h2&gt;
  
  
  useMutation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [mutate] = useMutation(
  (values) =&amp;gt; axios.post("http://localhost:7777/api", values),
  {
    onSettled: () =&amp;gt; {
      queryCache.refetchQueries("tasks");
    },
  }
);

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

&lt;/div&gt;



&lt;p&gt;I have called the &lt;code&gt;mutate&lt;/code&gt; function when the form is submitted. and gave &lt;code&gt;newTask&lt;/code&gt; as an argument. &lt;code&gt;useMutation&lt;/code&gt; got that value as a parameter and send a post request to my express API. as a result a todo is created.&lt;/p&gt;

&lt;p&gt;But, we can take this to next level. what if I want to see the submitted todo task before the api call is finished? Here comes an &lt;code&gt;optimistic update&lt;/code&gt;. We will optimistically update the UI for a better User experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Optimistic Update
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [mutate] = useMutation(
  (values) =&amp;gt; axios.post("http://localhost:7777/api", values),
  {
    onMutate: (newTask) =&amp;gt; {
      // Cancel any outgoing refetches (so they don't overwrite our optimistic update)
      queryCache.cancelQueries("tasks");
      //   optimistic update
      const previousTasks = queryCache.getQueryData("tasks");
      queryCache.setQueryData("tasks", (old) =&amp;gt; [...old, newTask]);
      return () =&amp;gt; queryCache.setQueryData("tasks", previousTasks);
    },

    onError: (error, newTask, rollback) =&amp;gt; {
      //   If there is an errror, then we will reset the tasks to previous tasks
      rollback();
    },
    onSettled: () =&amp;gt; {
      queryCache.refetchQueries("tasks");
    },
  }
);

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

&lt;/div&gt;



&lt;p&gt;Look we have two new methods. one is &lt;code&gt;onMutate&lt;/code&gt; another is &lt;code&gt;onError&lt;/code&gt;. &lt;code&gt;onMutate&lt;/code&gt; will call as soon as the form is submitted. so on this method, I am updating the todo list and show the updated list to the user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//   optimistic update
const previousTasks = queryCache.getQueryData("tasks");
queryCache.setQueryData("tasks", (old) =&amp;gt; [...old, newTask]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But, what if an error occurred? for example, user goes offline as soon as he submitted the new todo? here comes the &lt;code&gt;onError&lt;/code&gt; method. It will call the &lt;code&gt;rollback&lt;/code&gt; function (the function which is returned from &lt;code&gt;onMutate&lt;/code&gt;) and on cache, we will set the previous list as listItems array.&lt;/p&gt;

&lt;p&gt;And after that, we will refetch the &lt;code&gt;tasks&lt;/code&gt; list on &lt;code&gt;onSettled&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;I think, If you understand &lt;code&gt;create todo&lt;/code&gt;, you will easily understand delete and update items.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update Item Form
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form
  onSubmit={(e) =&amp;gt; {
    e.preventDefault();
    mutate({ task: value });
    reset();
    toggle(false);
  }}
&amp;gt;
  &amp;lt;input
    type="text"
    autoFocus
    className="edit"
    onChange={handleChange}
    value={value}
  /&amp;gt;
&amp;lt;/form&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Update Item Mutation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [mutate] = useMutation(
  (newTodo) =&amp;gt; axios.put(`http://localhost:7777/api/${todo._id}`, newTodo),
  {
    onMutate: (newTask) =&amp;gt; {
      console.log(newTask);
      // Cancel any outgoing refetches (so they don't overwrite our optimistic update)
      queryCache.cancelQueries("tasks");

      // Snapshot the previous value
      const previousTask = queryCache.getQueryData("tasks");

      // Optimistically update to the new value
      queryCache.setQueryData("tasks", (oldTasks) =&amp;gt;
        oldTasks.map((item) =&amp;gt;
          item._id === todo._id ? { ...item, task: newTask.task } : item
        )
      );

      return () =&amp;gt; queryCache.setQueryData("tasks", previousTask);
    },

    onError: (error, newTask, rollback) =&amp;gt; {
      //   If there is an errror, then we will reset the tasks to previous tasks
      rollback();
    },
    onSettled: (data, error, newTask) =&amp;gt; {
      queryCache.refetchQueries("tasks");
    },
  }
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Delete Item
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; const [mutateToggle] = useMutation(
    (values) =&amp;gt; axios.patch(`http://localhost:7777/api/${todo._id}`),
    {
      onSettled: () =&amp;gt; {
        queryCache.refetchQueries('tasks');
      },
    }
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will get the full working code on this repository.&lt;br&gt;
&lt;a href="https://github.com/ashiqdev/React-query-TodoList"&gt;React-query Todo App&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What is the purpose of Dockerfile and Docker-compose in development mode?</title>
      <dc:creator>Ashiqur Rahman</dc:creator>
      <pubDate>Wed, 23 Sep 2020 13:34:22 +0000</pubDate>
      <link>https://dev.to/ashiqcseworld/what-is-the-purpose-of-dockerfile-and-docker-compose-in-development-mode-10b2</link>
      <guid>https://dev.to/ashiqcseworld/what-is-the-purpose-of-dockerfile-and-docker-compose-in-development-mode-10b2</guid>
      <description>&lt;p&gt;I am building a MERN stack app. but I am not sure about the benefit of dockerize it on development mode.&lt;br&gt;
I saw many examples on github where there are separate Dockerfile on client and server folder and there is a docker-compose file where they import client and server services. but do I really need them? &lt;/p&gt;

&lt;p&gt;If I need then, how can I run command parallelly? suppose I need to build the backend in watch mode in one terminal and in another terminal I need to execute the yarn start command. How can I achieve that?&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>devops</category>
      <category>docker</category>
    </item>
    <item>
      <title>Different ways of state management in a react app</title>
      <dc:creator>Ashiqur Rahman</dc:creator>
      <pubDate>Sun, 06 Sep 2020 12:04:56 +0000</pubDate>
      <link>https://dev.to/ashiqcseworld/different-ways-of-state-management-in-a-react-app-1hdf</link>
      <guid>https://dev.to/ashiqcseworld/different-ways-of-state-management-in-a-react-app-1hdf</guid>
      <description>&lt;p&gt;I was always confused by the various techniques of state management. so, I have decided to build an app using different state management techniques. I hope it will be easier for beginners to compare among those techniques and they will get a basic overview of them.&lt;/p&gt;

&lt;p&gt;I build a todo list app using react-context-api, react-redux and redux-toolkit(recommended by redux)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ashiqdev/React-Context-Todo-Application"&gt;React-Context-Api&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ashiqdev/React-Redux-Todo-Application/tree/react-redux"&gt;React-Redux&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ashiqdev/React-Redux-Todo-Application/tree/redux-toolkit"&gt;Redux-Toolkit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Probably, from now on, I will use redux-toolkit in my side projects because it reduces lots of boilerplate code and with the help of the library called &lt;code&gt;immer&lt;/code&gt;, it is possible to mutate the state directly. &lt;code&gt;immer&lt;/code&gt; will make the code immutable under the hood.&lt;/p&gt;

&lt;p&gt;For example, in traditional redux reducer in order to add an item to an array we have to do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return [...state, { id: uuid(), task: payload, completed: false }];
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;But, by using redux-toolkit we can mutate the array directly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;state.push({ id: uuid(), task: action.payload, completed: false });
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>react</category>
      <category>redux</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Difference between innerText, textContent, innerHtml and outerHtml</title>
      <dc:creator>Ashiqur Rahman</dc:creator>
      <pubDate>Wed, 26 Aug 2020 16:21:21 +0000</pubDate>
      <link>https://dev.to/ashiqcseworld/difference-between-innertext-textcontent-and-innerhtml-2d8m</link>
      <guid>https://dev.to/ashiqcseworld/difference-between-innertext-textcontent-and-innerhtml-2d8m</guid>
      <description>&lt;p&gt;Often we need to extract the text from Html elements. but &lt;br&gt;
sometimes we are puzzled about the difference between them. let's tackle them now. this is our html element: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;
   Sub Div
   &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;I am hidden&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;we want to, extract the text part of the above element. let's write some javascript(basically dom-manipulation),&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;const&lt;/span&gt; &lt;span class="nx"&gt;heading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;h2&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;heading&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&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;heading&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;You can see in the browser console. both outputs are almost the same (the one which uses '&lt;em&gt;textContent&lt;/em&gt;' is not trimmed properly)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://imgbb.com/" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ibb.co%2FwR95q3Y%2Fscreenshot.png" alt="screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, what is the difference between them? For example, we add a style tag inside h2 element.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;
   Sub Div
   &lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;h2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;orangered&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;I am hidden&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;now if you console.log again. you will get this as output&lt;/p&gt;

&lt;p&gt;&lt;a href="https://imgbb.com/" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ibb.co%2FbFm14c1%2Fscreenshot-1.png" alt="screenshot-1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are seeing that the &lt;em&gt;textContent&lt;/em&gt; is giving the whole style element along with text and &lt;em&gt;innerText&lt;/em&gt; is giving us the human-readable text.&lt;/p&gt;

&lt;p&gt;There is another useful difference between them. suppose we hidden the visibility of an element by applying css rules and then try to extract them.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;h2&lt;/span&gt; &lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;
      Sub Div
      &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;I am hidden&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Now let's take a look what console.log gives us:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ibb.co/hM3WHzP" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ibb.co%2FmBfqtWL%2Fscreenshot-2.png" alt="screenshot-2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are seeing that &lt;em&gt;textContent&lt;/em&gt; does not care about the css rules but &lt;em&gt;innerText&lt;/em&gt; does. So, &lt;em&gt;textContent&lt;/em&gt; would be handy If we need to get the text of an element that is hidden by CSS. 😉&lt;/p&gt;

&lt;p&gt;The other two techniques are &lt;em&gt;innerHtml&lt;/em&gt; and &lt;em&gt;outerHtml&lt;/em&gt;. I think if we see the output in browser console we will understand them easily as they are pretty self-explanatory.&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;const&lt;/span&gt; &lt;span class="nx"&gt;heading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;h2&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;heading&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&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;heading&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;outerHTML&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;let's see the output in the browser cosnole&lt;/p&gt;

&lt;p&gt;&lt;a href="https://imgbb.com/" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ibb.co%2FHFPjYq4%2Fscreenshot-4.png" alt="screenshot-4"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>html</category>
    </item>
  </channel>
</rss>
