Bacancy Bacancy
  • Customers

      Fortune 500 Clients

      Verizon
      Verizon
      Franklin Templeton
      Franklin Templeton
      The Container Store
      The Container Store
      KPMG
      KPMG
      AdviceWorks
      AdviceWorks
      Bridgestone
      Bridgestone
      NatWest Markets
      NatWest Markets
      Shell
      Shell
      Bangkok Bank Ltd
      Bangkok Bank Ltd
      The Children's Place
      The Children's Place
      Edward Jones
      Edward Jones
      United Parcel Service
      United Parcel Service
      Academy Sports & Outdoors
      Academy Sports & Outdoors

      Case Studies

      React JS VueJS Angular JS React Native Flutter Full Stack
      Ruby on Rails Node JS Golang AI & ML Data Science Java
      Python Salesforce DevOps Block Chain Mobile App Embedded & Hardware

      Industries

      Information Technology BFSI Education Marketing & Advertising Manufacturing Retail Logistics & Transportation
      Healthcare eCommerce Public Services Travel & Hospitality Cloud Telecommunications Real Estate
      Explore All
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • what we do

      Experience

      Digital Workplace Services Product Enhancement

      Insights

      AI & Automation Data Analytics

      SAP Solutions

      SAP Consultation

      Innovate

      Robotic Process Automation Software Engineering Services Internet of Things (IoT) Data Science Artificial Intelligence Machine Learning

      Accelerate

      Cloud - Bacancy Combat Digital Process Automation Open Source Microsoft Dynamics Salesforce

      Assure

      Quality Assurance IT Staff Augmentation

      Embedded & Hardware

      Product Engineering Analog Design Services FPGA Engineering Service Wireless Design Embedded Software Design

      not list

      Hardware Engineering Power Engineering IoT Hardware
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • who we work with

      Industries

      Banking Financial services & Insurance Startups Oil & Gas

      not list

      Healthcare Life Science Real Estate & Construction Logistics
      bacancy

      Let’s grow together Partner with us

      get quote
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • about us

      Culture

      Agile Mindset Bacancy Values Bacancy Culture

      About Company

      About Us Leadership Team Awards & Recognition Infrastructure

      not list

      Customer Reviews Our Locations Partnership Media Coverage

      WE ARE

      GREAT PLACE TO WORK - CERTIFIEDTM

      Building and sustaining High-Trust, High-Performance CultureTM

      Bacancy Great Place to Work
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • technology

      Front End

      Angular Reactjs Vue.js UI/UX

      Platforms

      MS Dynamics Salesforce

      Back End

      Ruby on Rails Node.js Golang Laravel .NET Java Python

      Mobile

      React Native Flutter Android iOS

      Cloud

      AWS DevOps

      QA

      Automation Testing Software Testing

      Embedded & Hardware

      Embedded
      bacancy

      World-class expertise,Delivered

      get quote
      Explore All
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • PRODUCTS

      EV Products

      Battery Management System Motor Controller AC Charger Explore All

      not list

      CCS2 Controller DC Fast Charger AC Charge Controller
      bacancy

      Let’s grow together Partner with us

      get quote
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
hire developers

Bacancy

Bacancy represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.

12+

Countries where we have happy customers

1050+

Agile enabled employees

06

World wide offices

12+

Years of Experience

05

Agile Coaches

14

Certified Scrum Masters

1000+

Clients projects

1458

Happy customers

  • Customers
      Case Studies
      • React JS
      • Angular JS
      • Vue JS
      • Node JS
      • AI & ML
      • Explore All
      Fortune 500 Clients
      • Verizon
      • The Container Store
      • KPMG
      • Academy Sports & Outdoors
      • Bangkok Bank Ltd
      • The Children's Place
      • Edward Jones
      • Franklin Templeton
      • AdviceWorks
      • NatWest Markets
      • Bridgestone
      • United Parcel Service
      Industries
      • Information Technology
      • BFSI
      • Education
      • Marketing & Advertising
      • Manufacturing
      • Retail
      • Logistics & Transportation
      • Healthcare
      • eCommerce
      • Public Services
      • Travel & Hospitality
      • Cloud
      • Telecommunications
      • Real Estate
  • What we do
      Experience
      • Digital Workplace Services
      • Product Enhancement
      Insights
      • AI & Automation
      • Data Analytics
      SAP Solutions
      • SAP Consultation
      Innovate
      • Blockchain
      • Software Engineering Services
      • Internet of Things (IoT)
      Accelerate
      • Cloud - Bacancy Combat
      • Digital Process Automation
      • Open Source
      • Microsoft Dynamics
      • Salesforce
      • Service Experience Transformation
      Assure
      • Testing
      • Resource Augmentation
      Embedded & Hardware
      • Product Engineering
      • Analog Design Services
      • FPGA Engineering Service
      • Wireless Design
      • Embedded Software Design
      • Hardware Engineering
      • Power Engineering
      • IoT Hardware
      • AL/ML
  • who we work with
      Industries
      • Banking Financial services & Insurance
      • Startups
      • Oil & Gas
      • Healthcare Life Science
      • Real Estate & Construction
      • Logistics
  • About Us
      About Company
      • About Us
      • Leadership Team
      • Awards & Recognition
      • Infrastructure
      • Our Locations
      • Partnership
      Culture
      • Agile Mindset
      • Bacancy Values
      • Bacancy Culture
  • Technology
      Front End
      • Angular
      • Reactjs
      • Vue.js
      • UI/UX
      Platforms
      • MS Dynamics
      • Salesforce
      Back End
      • Ruby on Rails
      • Node.js
      • Golang
      • Laravel
      • .NET
      • Java
      • Python
      Mobile
      • React Native
      • Flutter
      • Android
      • iOS
      Cloud
      • AWS
      • DevOps
      QA
      • Automation Testing
      • Software Testing
      Embedded & Hardware
      • Embedded
      Explore All
  • Products
    • Battery Management System
    • Motor Controller
    • CCS2 Controller
    • AC Charger
    • DC Fast Charger
    • AC Charge Controller
    • Explore All
  • Careers
  • Work @ Bacancy
  • Blogs
  • Resources
  • Customer Reviews
  • Contact
  • Get Quote
Large Scale React Application

Structure Your React-Redux Web Application To Unclutter Your Project and Your Life

Chandresh Patel
Chandresh Patel CEO and Agile Coach
Last Updated on August 3, 2022 | Written By: Riken Solanki
July 16, 2018 8 min read

Since the past few years, I have been writing codes for very large scale React application applications along with a team of other React developers to organize the code so it can be scaled as the application evolves. Here, we make sure that we put extra attention to a good folder structure. So, I decided to write this blog to share my knowledge and expertise highlighting the best way to organize future React projects.

There are a number of blogs and articles out there on the best way to organize your React application; however; I am not completely satisfied with their approaches and explanations. So, I decided to invest my time to educate React developers out there in my community to provide valuable information on the best possible way to organize the future React projects. So, listed are the principles that I, along with my team, take into consideration while structuring React application. The proficient React developers at Bacancy Technology make sure to apply these approaches in all the “JS Apps.”

Let’s start with Sophie Alpert’s advice.

Sophie Alpert

Make sure you and your team are working together, following the same structuring practice. It is advisable to decide from the beginning of your project; otherwise, it will become a quite lengthy process than usual.

What are the most common challenges you face when you build an application?

  • Together with the help of software developers, you are building an application following the client’s requirement.
  • You client wants to have new features in the application
  • The client has suggested eliminating some features, you are not finding it perfect, even though you make it work as per the client’s request.
  • Still, the client has come up with new features that weren’t expected, where you have to patch the code, you are not happy, but it was working as per the client’s requirements.
  • At the final stage, the code looks really complicated, and it’s hard to read, as well as understand, looks like vegan Mexican Lasagna.

At last, the client wants to create a new version of the application with the fresh new code and features, because some of the codes in the application you have designed have become complicated, and that is hard to maintain. It has happened because the application was not designed in an appropriate manner from scratch.

So, I was Googling to find a solution, and I learned about React boilerplate project on Github to organize all the files by types. You can follow this practice to build your website or application.

This is just an abstract example, the real-world application is more complex, then it looks in the below image.

/src
  /actions
    /notifications.js
      
 /components 
    /Header
    /Footer
    /Notifications
      /index.js  /containers
    /Home
    /Login
    /Notifications
      /index.js  /images
    /logo.png  /reducers 
    /login.js
    /notifications.js  /styles 
    /app.scss
    /header.scss 
    /home.scss
    /footer.scss
    /notifications.scss  /utils  index.js  

Source: https://medium.com/@alexmngn

Still, this is not the best structure practice to follow. Organizing files by type makes it difficult to manage the application in the long run, and till the time you realize the issue, it becomes too late to invest time and energy to change everything from scratch.

But my personal preference is grouping all the features together.

/src
  /components 
    /Button 
    /Notifications
      /components
        /ButtonDismiss  
          /images
          /locales
          /specs 
          /index.js
          /styles.scss
      /index.js
      /styles.scss  /scenes
    /Home 
      /components 
        /ButtonLike
      /services
        /processData
      /index.js
      /styles.scss    /Sign 
      /components 
        /FormField
      /scenes
        /Login
        /Register 
          /locales
          /specs
          /index.js
          /styles.scss  /services
    /api
    /geolocation
    /session
      /actions.js
      /index.js
      /reducer.js
    /users
      /actions.js
      /api.js
      /reducer.js  index.js 
  store.js

Source: https://medium.com/@alexmngn

Stick to the Rules: Sorting File is Never a Good Idea

– Applications/ – components/ – containers/
In my initial stage, the most common advice was to separate the components into stateful components as well as pure functions.

The purpose of following this method is that your components can be reused elsewhere. This could be the case for many projects, but I am genuinely not sure how it could be for all applications. Let me keep the functionality thing apart, even placing the pieces of components that hold the same potential to perform into the distinct corner of your file system is counter-intuitive and counter-productive.

Components: Everything Deserve its Name

Accurately and grammatically correct name can save you from questions and your teammates from misperceptions. So, usually in every folder of a component folder, I keep the first later as capital one, so whenever I search for a file by name or a project, I can easily identify by the name. i.e. “header VS Header”.

Naming is not just the creative part, but it is one of the hardest parts of software development. So, it is advisable to think three times before you introduce new entities like functions, methods, or variables. One more piece of advice is inline the code if it is specifically applied just once as it will make reading a code a lot similar to watching your favorite video across various devices.

Components
Source: Hackernoon

Exploit the File System

Code requires a standard procedure that starts with the hierarchy of directories. So, before you access the file, it is needless to say that it should be very well organized and reflects the same hierarchy so you can save your valuable time in navigation across the codebase.

Do not limit yourself with the directories, you can simply split code between files without any sort of hesitation! It is advisable to not place multiple entities into single, put the one per file. Doing so will improve your navigation experience and files list will become a kind of your codebase. So, moving files in-between the directories are a lot simpler than moving sections itself across codebase files. Reducer for intl.js look as shown in the below image:

Reducer for intl.js
Source: https://hackernoon.com/@ven_korolev

Routes

Make sure to keep all the routes in the current bundle. As it is completely ok to have a few route files for the same bundle. Usually, I assemble all keep routes in every route’s file and export them as a collection. At a later stage, in my entry point of application, I simply import all the routes together and merge them into one array inside the Router.

Routes
Source: https://hackernoon.com/@ven_korolev

File Size Recommendation

It is advisable to not surpass the size above 300 lines per file. Anything bigger than that may warrant splitting.

Keep Your Tools Separated from General Business Logic

Repeating coding will be there in any sort of application, it is usually separated as utilities, libraries or helpers, which will assist in structuring unique components of business logic.

Keep in mind that your tools should be only separated from business logic, not from the codebase. So hold yourself at a certain edge of process separation as the single directory with all the tools and time will grow up significantly.

Users/
  generic/
    helpers/
      is-email.js
  Profile/
    isEmail() required on user profile page
  SignUp/
    isEmail() also required in sign up process

If the two modules are using the same tool, then it is advisable to put the tool closet to the parent module. So you will have multiple equally names directories along with the tools in your application. It not advisable to have tools from sibling directories; following the rule of thumb, only one direction should be imported across the app for the simple maintenance of code.

Your App Structure must reflect your business logic

Give your business logic the utmost preference over anything. People would easily relate to your business logic if it is coming from real-life experiences instead of framework abstractions. You cannot simply avoid the influence of tools or framework to your application, but I would advise you to minimize it. In case if it is acceptable, then isolate business logic from tools and frameworks abstractions.

In my initial stage of react/redux app development, I was in search of the finest practices in codebase structuring as I wasn’t in favor of the time component/container approach. Even after half of the decade practices I still don’t see that much difference between components and containers.

So, fortunately, I come up with my very own approach – hierarchy of directories upon the business logic models. As it does not distinguish components by presentational or logical type instead states that all components are equal and each of the components includes both logic as well as presentation.

business logic
https://hackernoon.com/@zaguiini

Wrapping Up

This folder structure has saved me lots of valuable time, and it is a lot simpler than all related entities assembled together. As I mentioned above, I have devoted my time to write this blog to help you organize your project in many ways, and trust me, this is the reason I loved it and you will too love it for sure.

If you are interested in leveraging my React-redux expertise, you can fill up the contact us form, and we will work together to help you achieve your business/product/service goal. If you want to see the projects so far, I have done along with my teammates, then please go through the attached links.

https://github.com/bacancy/React-Js-Structure

Hire ReactJS developer from us to address your large web application development needs. Bacancy is a technologically innovative and advanced ReactJS development company. We are a team of skillful react developers who have in-depth knowledge and extensive experience in react.js development services. So, if you are looking for a single developer or a team to structure your React application choose us as your one-stop development partner.


Expand Your Digital Horizons With Us.

Start a new project or take an existing one to the next level. Get in touch to start small, scale-up, and go Agile.


Or
E-mail us : [email protected]

Your Success Is Guaranteed !

Related Articles

React Design Patterns
Dipal Bhavsar

August 11, 2023

React JS

React Design Patterns: Everything You Should Know

By : Dipal Bhavsar

Quick Summary: Explore tried-and-tested strategies to develop streamlined, intuitive user interfaces and maintainable applications with React design patterns. From component reusability to state management, our...

< 1 Minute Read
Read More
Voice UI in Web
Divyesh Maheta

July 13, 2023

Web Development

How Can You Leverage Voice User Interface in Web Development?

By : Divyesh Maheta

Quick Summary: There was a time when people used to interact with computers using Character User Interface or CUI; wherein people used to type text...

< 1 Minute Read
Read More
React Carousel
Ritwik Verma

July 4, 2023

React JS

15 Top React Carousel Component Libraries and their Usage Trends

By : Ritwik Verma

Summary: React is a popular and robust JavaScript library for creating user interfaces that help build dynamic, interactive, and responsive web applications. To make it...

< 1 Minute Read
Read More

How Can We Help You?

india India (HQ)

Corporate House
15-16, Times Corporate Park, Thaltej, Ahmedabad, Gujarat 380059

USA USA

601 Brickell Key Drive, Suite 700, Miami, Florida, 33131, USA

canada Canada

71 Dawes Road, Brampton, On L6X 5N9, Toronto

australia-flag Australia

351A Hampstead Rd, Northfield SA 5085

UAE UAE

1608 Clover Bay, Business Bay, Dubai, UAE. PO Box 62049

sweden Sweden

Junkergatan 4, 126 53 Hagersten


Get in Touch

call-yellow-icon

Contact Number

+1 347 441 4161

gmail-icon

Email Us

[email protected]


  • Employee
  • Brochure
  • Quality Assurance
  • Resources
  • Privacy Policy
  • Sitemap
  • Solutions
  • Careers
  • Testimonials
  • Tutorials
  • QandA
  • Contact Us
  • bacancy google review 4.6
    bacancy google review
    bacancy glassdoor review 4.5
    bacancy glassdoor review
    bacancy clutch review 4.8
    bacancy clutch review
    bacancy goodfirms review 4.5
    bacancy goodfirms review
    iso
    X

    Get Our Newsletter

    Be The First To Get The Latest Updates And Tutorials.

    Request A Free Consultation