Why I switched from EJS to React! (2024)

React is here, to make your experience of UI building painless and time-efficient and in a world full of controversies regarding whether to call it a library or a framework, I’d rather term it, a Friend? Just kiddin’. Been with this web stuff for a while, and this shift from a template engine like ejs to framework like react has been quite a thing for me. In this article, I’m gonna share what drove me to make this switch and what I still miss about the former. Now, these are my personal opinions and anyone can impart them differently. Here’s the list,

The first thing about react that captured my attention was the page (almost) never reloads. As a matter of fact, react implements what is called a Single Page Application where everything you write is bundled up into a single HTML file which is constantly being re-written with your components as per the needs of the user and thus presents quite a dynamic view to the audience

While ejs does allow javascript logics (like else-if conditioning or for loops), the syntax is both cumbersome to write and a pain to read. React introduces the JSX syntax, which while maintaining the proximity to traditional HTML, elucidates the use of programming logic to a great extent. You can render HTML tags in an array map method, ain’t that crazy!

Modularity is the cornerstone for the popularity of a tool in a large professional environment, especially when a bulk load of the task is distributed into few teams and is where react strikes in. As said earlier, in react everything is a component, it builds a nice hierarchy where each components render to their respective parents and so on until it reaches the root sitting at the top, often called App.js. EJS also provides such modularity to an extant with its include function but gets stumped owing to the inability of passing any data from the parent to children as react accomplishes with props.

The data flow in react is centralized which leads the developer one step ahead in state management and grants more control over the variables. While react itself can manage the state with its context API, it is better provided by a third party state container, like Redux.js. It works in an action-reducer cycle where all the app level data are fetched and accumulated via action functions into a central file, often referred to as the Store, which in turn delivers the data to required components via other action functions. The data flow in react is mostly unidirectional, top to bottom, but sometimes can be compromised to travel in reverse.

Why I switched from EJS to React! (1)

Needless to say that the community support for react is more than huge and by that, I’m talking of the ready to use npm packages and components built by millions of developers around the globe, just waiting to be a part of your awesome project. React readymade components apart from being easy to install and fun to adapt, are quite the time and effort savers and let you focus one thing you’re assigned to do. Just type in npm i package_name and the package is yours, forever😍.

I mean, seriously, that’s a cause too😁. It’s quite top on the trend and gives you a little flex, I’m a frontend developer, I code in React 😎.

About the things I miss in react? Well jQuery tops the list. Like c’mon that cute friendly little library — not that you can’t use jQuery in react but that would be like riding an R15 with the side wheels on!

So that was it, why don’t you share your favourite library/framework! And as always, happy coding.

Why I switched from EJS to React! (2024)

FAQs

Why I switched from EJS to React!? ›

With React, you can render only the necessary components and achieve a higher level of performance, especially when dealing with large and complex applications. EJS, on the other hand, may face performance issues when dealing with extensive server-side rendering and frequent page reloads.

Is JSX better than EJS? ›

5. Component Reusability: EJS supports component reusability to an extent, but it requires manual separation and inclusion of partial templates. JSX, on the other hand, embraces the component-based approach of React, allowing for easy and reusable component creation with props and state.

Is EJS still in use? ›

EJS has a large community of active users, and the library is under active development.

Why we use React JS instead of node JS? ›

Unlike Node. js, React is best used for creating highly interactive and complex user interfaces in web or mobile applications. Although React integrates well with Node.

Can I use React and EJS together? ›

You make React build the UI. Not some other templating engine. It makes sense if you want to incrementally add React to an existing, large project that uses EJS (which React uses as a selling point). It also makes sense if you are implementing generators and need templatized react components.

What is the disadvantage of JSX? ›

JSX as a barrier

ReactJS uses JSX. It's a syntax extension that allows HTML with JavaScript mixed together. This approach has its own benefits, but some members of the development community consider JSX as a barrier, especially for new developers. Developers complain about its complexity in the learning curve.

Should I use React without JSX? ›

JSX is not a requirement for using React. Using React without JSX is especially convenient when you don't want to set up compilation in your build environment.

Is ejs still used 2024? ›

With these better alternatives in mind, we announce that EBSCO will shut down the EJS Reader Site and related services effective June 30, 2024. For details on the EJS Reader Site and related services and the available alternatives, please use the following links: EJS Reader Site.

Can EJS be used for frontend? ›

EJS is embeded Java Script and is used in templates building Node. js app. It helps web designers/frontend developers collaborate with backend developers in parallel and to easily integrate their work.

Is it worth it to use EJS? ›

If you're creating a static web page with no dynamic content, HTML5 is the best choice. However, if you're building a web application that requires dynamic content, EJS is a good choice as it allows you to generate HTML content on the server-side. Templating: HTML5 does not have built-in templating support.

Is ReactJS still in demand? ›

Many existing web applications are built with ReactJS and companies still opt for it for their upcoming projects. Therefore, there will be a demand for ReactJS in 2024 for maintaining existing apps and creating new ones.

Is React a front-end or backend? ›

React Js Js is a globally used Front-end JS framework and is popular with both software developers and project sponsors. Well, React Js is not a backend development. While building a project, React Js Js Developers focus mainly on the user's experience and so it's called Frontend.

Should I learn Node or React first? ›

While React is undoubtedly a powerful front-end library, mastering Node. js first opens up a world of opportunities that will enhance your overall development prowess. Here are three compelling reasons to prioritize Node.

When should you not use react JS? ›

When you are making an app like a game or a demanding creative app, React is not the best choice. This problem stems from the fact that it uses a Virtual DOM. Virtual DOMs, or VDOMs, are layers that help make unoptimized DOM manipulations faster.

What is better than ejs? ›

Handlebars. js, React, Pug, JSX, and Mustache are the most popular alternatives and competitors to EJS. Powerful collaboration, review, and code management for open ... Powerful collaboration, review, and code management for open ...

Can I use JavaScript in EJS? ›

EJS (Embedded JavaScript Templating) is one of the most popular template engines for JavaScript. As the name suggests, it lets us embed JavaScript code in a template language that is then used to generate HTML.

Why is JSX better? ›

JSX, with its blend of JavaScript and markup-like syntax, has undeniably revolutionized the way developers write UI code in React. By abstracting away the complex JavaScript logic needed to create elements and components, JSX makes React development more intuitive and efficient.

What is the advantage of using JSX? ›

Benefits of Using JSX

JSX enables React to display error and warning messages, which aids in debugging. With JSX, you can write large pieces of code in a more organized and simplified manner. If you have a good understanding of HTML, you'll find it easier to use JSX when developing React applications.

Should I use JSX or not? ›

Coding JSX

JSX allows us to write HTML elements in JavaScript and place them in the DOM without any createElement() and/or appendChild() methods. JSX converts HTML tags into react elements. You are not required to use JSX, but JSX makes it easier to write React applications.

Top Articles
Latest Posts
Article information

Author: Manual Maggio

Last Updated:

Views: 6378

Rating: 4.9 / 5 (69 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Manual Maggio

Birthday: 1998-01-20

Address: 359 Kelvin Stream, Lake Eldonview, MT 33517-1242

Phone: +577037762465

Job: Product Hospitality Supervisor

Hobby: Gardening, Web surfing, Video gaming, Amateur radio, Flag Football, Reading, Table tennis

Introduction: My name is Manual Maggio, I am a thankful, tender, adventurous, delightful, fantastic, proud, graceful person who loves writing and wants to share my knowledge and understanding with you.