Category: Software

Software

MICROFRONTENDS WITH REACT

It is common knowledge that the best method to tackle any software issue is to disassemble the problem. Whether it be by rewriting your code to create functions that are more manageable and clear, there are multiple ways to accomplish this.

Why use Micro Frontends?

Large applications have profited in multiple ways from the development of microservices, which have advanced in recent years. It is helpful in the process of efficiently developing, deploying, and scaling the separate components of the application backend.

Nevertheless, many developers have become aware that similar difficulties exist for the front-end as well. It is at this stage that the breaking up of the frontend monolith into individual micro front-ends usually begins.

Module federation (Module Federation | webpack)

Module Federation allows a JavaScript application to dynamically load code from another application and in the process, share dependencies. If an application consuming a federated module does not have a dependency needed by the federated code, Webpack will download the missing dependency from that federated build origin

I’ll create 2 apps in this article:

  • First: Container app that will be used as a base for the micro frontends.
    •  
  • Second: The counter app that will get rendered inside the container app.

Let’s update the webpack.config.js file inside the Counter app. Add ModuleFederationPlugin to the plugins array with the following configuration:

webpack.config.js

plugins: [ // This is important part
    new ModuleFederationPlugin({
      name: "counter",
      filename: "remoteEntry.js",
      remotes: {},
      exposes: {
        "./Counter": "./src/components/Counter",
      },
      shared: {
        ...deps,
        react: {
          singleton: true,
          requiredVersion: deps.react,
        },
        "react-dom": {
          singleton: true,
          requiredVersion: deps["react-dom"],
        },
      },
    }),
    new HtmlWebPackPlugin({
      template: "./src/index.html",
    }),
Let’s update the webpack.config.js file inside the Container app.
plugins: [ // This is important part
    new ModuleFederationPlugin({
      name: "container",
      filename: "remoteEntry.js",
      remotes: {
        counter: "counter@http://localhost:8081/remoteEntry.js",
      },
      exposes: {},
      shared: {
        ...deps,
        react: {
          singleton: true,
          requiredVersion: deps.react,
        },
        "react-dom": {
          singleton: true,
          requiredVersion: deps["react-dom"],
        },
      },
    }),
    new HtmlWebPackPlugin({
      template: "./src/index.html",
    }),
  ],
Now in src/App.js
import React from "react";
import ReactDOM from "react-dom";
import { Counter } from 'counter/Counter';
import "./index.css";
const App = () => (
  <div className="container">
    <h1>Container App</h1>
    <Counter /> // Micro frontend app
  </div>
);
ReactDOM.render(<App />, document.getElementById("app"));

If we run both apps, we should see Counter app inside of Container app working as it should.

Notice: both apps need to be running for Microfrontends to work.

Also in production you can update the app deploy url’s to remote server url.

 

That’s it.

Now you can split your apps into smaller, more manageable chunks.

 

Thanks for reading!

Software

INTUITIVE UI.WHAT DOES IT MEAN AND HOW CAN YOU DESIGN IT?

People everywhere and everyday use apps for all kinds of purposes. They use them for work, leisure, motivation, planning, socializing, learning, and the list could go on like this forever. Therefore, building a successful product that can stand out from the clutter becomes a real challenge. Consumers know right away when they don’t like using an app, and they can easily recognize when they actually love using one. What they fail to understand is that one of the main reasons they love using it, is because the app is intuitive.

So, if you’re a UX/UI designer, a developer, or a project manager, you should know what it means to build an intuitive app. How exactly can you build one when the concept of intuition itself is so vague?

 Every intuitive app revolves around one keyword: easy – easy to understand, easy to use, and easy to love. Although, the fact that it’s easy to use doesn’t mean that it’s simple to achieve.

 Throughout the whole building process, constantly think about one question: how will your consumers use the product. Everything you design or build should exist only to make your customer’s life easier.

 So, let’s take a look at a few things to keep in mind before you start designing a new app.

  • EASY TO DISCOVER
    The first interface sets the tone of your relationship with the app. A well-designed interface displays, from the first moment you open the app, all the main features in front of your eyes. Yet, everything looks clean and organized to avoid any chance of being overwhelming. Notifications, messages, settings, and all the main functionalities are within reach of your thumb for you to click and explore.
  • EASY TO UNDERSTAND
    You see a button with an envelope icon on top of it. Your intuition tells you that, most probably, that button will lead you to the messages section. You know the purpose of that button without having to click it first. The icon told you everything you needed to know.
    That is why, in an intuitive app, visual representation leads your journey as a user.
  • EASY TO PREDICT
    That leads us to the importance of predictability. When you click on a button, you already know that something will follow that action. For instance, if you click on a +, you expect that to give you the chance to add new items. If the prediction doesn’t happen, you become confused, and you are no longer satisfied with the product. Making the design so obvious makes the operation predictable, thus making the app intuitive.
  • EASY TO USE
    We’ve all used apps that make us go through tiring user flows, asking questions after questions, and moving us from one interface to another. So before you finish the task, you’re already annoyed and want to quit using the app. An intuitive product makes the flow efficient; it offers you what’s necessary, nothing less than what you need and nothing more. 
  • EASY TO INTERACT
    No one wants to click on a button and be left waiting and wondering without feedback. No reaction from the app might frustrate you. It might make you repeat the action over and over again and make you fail to complete it. That is why, for every action, there should be an immediate response that lets you know that the task has been successfully completed.
  • EASY TO FIX MISTAKES
    Using an app shouldn’t be so rigid; it should take into consideration your human flaws instead and help you correct them. Take Google, for example. When you search for a specific item and misspell the words, Google suggests the right options and the search engine still offers you the answers you were seeking. An intuitive app always offers solutions and solves your everyday mistakes.