Skip to main content

Tutorial NextJS - Day 2

Hari 2 – Navigasi, Layout, & Dynamic Routing Setelah berhasil melakukan instalasi dan membuat halaman pertama di Hari 1 , pada Hari 2 ini kita akan membuat website menjadi lebih hidup. Kita akan belajar cara membuat menu navigasi agar bisa pindah-pindah halaman, membuat tampilan menu yang konsisten (Layout), dan membuat halaman artikel yang pintar (Dynamic Routing). Tutorial ini tetap menggunakan Windows + VS Code dan melanjutan project nextjs-basic dari hari sebelumnya. 1. Navigasi Antar Halaman ( <Link> ) Di HTML biasa, kita menggunakan tag <a> untuk berpindah halaman. Namun, di Next.js kita menggunakan komponen khusus bernama <Link> . Kenapa harus pakai <Link> ? Jika pakai <a> , layar akan berkedip (loading ulang) setiap pindah halaman. Dengan <Link> , perpindahan halaman terjadi instan tanpa refresh. 1.1 Edit Halaman Home Kita akan menambahkan tombol untuk pergi ke halaman About. Buka file src/app/page.tsx , lalu ganti isinya dengan kod...

Why Use React JS? Pros, Cons, and Real Use Cases

 

Introduction

React JS has been one of the most popular JavaScript libraries for building user interfaces for many years. From small personal projects to large-scale applications, React is widely adopted by developers and companies around the world.

But why do so many people choose React JS?
Is it always the right choice?

In this article, we’ll explore why React JS is used, its advantages, limitations, and real-world use cases to help you understand when React makes sense — and when it doesn’t.


What Is React JS?

React JS is a JavaScript library developed by Facebook (now Meta) for building user interfaces, especially single-page applications (SPAs).

Instead of updating the entire page, React updates only the parts of the UI that change, making applications faster and more interactive.

React focuses on the view layer, meaning it handles how things look and behave in the browser.


Why Developers Choose React JS

React became popular because it solves many problems that traditional web development struggled with, especially as applications grew more complex.

Here are the main reasons developers use React.


Pros of Using React JS

1. Component-Based Architecture

React applications are built using components — small, reusable pieces of UI.

This approach makes:

  • Code easier to maintain

  • UI logic easier to reuse

  • Large projects easier to scale

Instead of writing everything in one file, developers can break the UI into clean, logical parts.


2. Fast Performance with Virtual DOM

React uses a Virtual DOM, which is a lightweight copy of the real DOM.

When something changes:

  • React updates the Virtual DOM first

  • It calculates the minimal changes needed

  • Only those changes are applied to the real DOM

This results in better performance, especially for dynamic applications.


3. Strong Ecosystem and Community

React has one of the largest developer communities in the world.

This means:

  • Thousands of libraries and tools

  • Tons of tutorials and documentation

  • Easy to find solutions when stuck

From routing to state management, almost everything already has a mature solution.


4. Easy Integration with Other Tools

React doesn’t force strict rules.

You can:

  • Use it with different backends

  • Add it gradually to an existing project

  • Combine it with other libraries easily

This flexibility makes React suitable for both new projects and legacy systems.


5. Backed by Major Companies

React is used and maintained by large tech companies.

Some well-known users include:

  • Meta (Facebook)

  • Netflix

  • Airbnb

  • Instagram

This gives developers confidence that React will continue to evolve and stay relevant.


Cons of Using React JS

Despite its popularity, React is not perfect. Understanding its limitations is important.


1. Learning Curve for Beginners

While React itself is simple, the surrounding ecosystem can feel overwhelming.

Beginners often struggle with:

  • JSX syntax

  • State management concepts

  • Hooks and component lifecycle

  • Tooling like bundlers and linters

React is beginner-friendly, but not beginner-only.


2. Rapid Ecosystem Changes

React evolves quickly.

New patterns and best practices appear often, which can lead to:

  • Outdated tutorials

  • Confusion for new developers

  • Frequent refactoring in long-term projects

Staying updated requires continuous learning.


3. Too Much Freedom Can Be Confusing

React gives developers many choices:

  • Different state management libraries

  • Multiple routing options

  • Various folder structures

While flexibility is good, it can also lead to inconsistent codebases if not managed properly.


4. Not Ideal for Simple Websites

For small, static websites, React can be overkill.

If you only need:

  • A simple landing page

  • Static content with minimal interaction

Then plain HTML, CSS, or a simple framework might be a better choice.


Real Use Cases of React JS

React shines in applications that require dynamic user interaction.

Here are some common real-world use cases.


1. Single-Page Applications (SPAs)

React is ideal for SPAs where:

  • Content updates without page reloads

  • User experience needs to be smooth and fast

Examples include dashboards, admin panels, and analytics tools.


2. Large-Scale Web Applications

React’s component structure makes it suitable for:

  • Enterprise-level applications

  • Long-term projects with many developers

It helps teams manage complexity effectively.


3. Interactive User Interfaces

Applications with:

  • Real-time updates

  • Forms and validations

  • Complex UI states

benefit greatly from React’s reactive nature.


4. Mobile App Development (via React Native)

React knowledge can be extended to mobile development using React Native.

This allows developers to:

  • Share concepts between web and mobile

  • Build cross-platform apps more efficiently


5. Progressive Web Apps (PWAs)

React works well with PWAs that:

  • Load fast

  • Work offline

  • Feel like native apps

This makes it a strong choice for modern web experiences.


When Should You Use React JS?

React is a great choice if:

  • You are building a dynamic web application

  • Your project is expected to grow

  • You want reusable UI components

  • Performance and scalability matter


When React JS Might Not Be the Best Option

You may want to avoid React if:

  • The website is mostly static

  • You want minimal setup and tooling

  • The project is very small and simple

Choosing the right tool depends on the problem, not the trend.


Conclusion

React JS is popular for a reason. Its component-based design, strong performance, and massive ecosystem make it a powerful tool for building modern web applications.

However, it’s not a one-size-fits-all solution. Understanding both its strengths and limitations helps you decide when React is the right choice.

Used correctly, React can significantly improve development speed, maintainability, and user experience.

Comments

Popular posts from this blog

Why Your React App Shows a Blank Page (And How to Fix It)

Introduction One of the most frustrating problems when working with React JS is opening your app and seeing… nothing . No error message. No UI. Just a blank page . This issue happens frequently, especially after deployment or routing changes. In this article, we’ll explain why React apps show a blank page , the most common causes , and how to fix them step by step . What a “Blank Page” Usually Means in React A blank page usually means: React failed to render the UI JavaScript error stopped execution Routing or build configuration is broken Most of the time, the issue is not React itself , but how the app is configured. 1. JavaScript Error in the Console The first thing you should always check is the browser console. How to Check Open the app Right click → Inspect Open the Console tab If you see a red error message, React stopped rendering. Common Examples Cannot read property of undefined Unexpected token Module not found Fix Read the...

Nginx vs Apache: Which Web Server Should You Use on a VPS?

Introduction When setting up a VPS for hosting websites or applications, one of the first decisions you’ll face is choosing a web server. The two most popular options are Nginx and Apache . Both are powerful, widely used, and production-ready — but they work very differently. In this article, we’ll compare Nginx vs Apache , explain how each one works , highlight their strengths and weaknesses , and help you decide which web server is better for your VPS setup . What Is a Web Server? A web server is software that: Receives requests from browsers Processes those requests Serves HTML, CSS, JavaScript, or API responses Popular web servers include: Nginx Apache LiteSpeed Caddy Among them, Nginx and Apache dominate most VPS environments . What Is Apache? Apache has been around since the mid-1990s and was the most widely used web server for many years. How Apache Works Apache uses a process-based or thread-based model : Each request is handled by a p...

React Build vs Development Mode: What’s the Difference?

Introduction Many React developers are surprised when their app works perfectly during development — but behaves differently after deployment. Features break, routing fails, environment variables disappear, or performance changes dramatically. Most of these issues come from not understanding the difference between React’s development mode and production (build) mode . In this article, we’ll explain: What development mode really does What changes in production builds Why bugs appear only after deployment How to avoid common build-related mistakes What Is Development Mode in React? Development mode is what you use when running commands like: npm start npm run dev In this mode, React prioritizes developer experience , not performance. Key Characteristics of Development Mode Detailed error messages Helpful warnings Hot reloading (instant updates) Slower performance (on purpose) Extra checks for unsafe patterns Development mode helps you find bugs e...