Book Image

Full-Stack React Projects

By : Shama Hoque
Book Image

Full-Stack React Projects

By: Shama Hoque

Overview of this book

The benefits of using a full JavaScript stack for web development are undeniable, especially when robust and widely adopted technologies such as React, Node, and Express and are available. Combining the power of React with industry-tested, server-side technologies, such as Node, Express, and MongoDB, creates a diverse array of possibilities when developing real-world web applications. This book guides you through preparing the development environment for MERN stack-based web development, to creating a basic skeleton application and extending it to build four different web applications. These applications include a social media, an online marketplace, a media streaming, and a web-based game application with virtual reality features. While learning to set up the stack and developing a diverse range of applications with this book, you will grasp the inner workings of the MERN stack, extend its capabilities for complex features, and gain actionable knowledge of how to prepare MERN-based applications to meet the growing demands of real-world web applications.
Table of Contents (19 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Setting up for React development


Before we can start developing with React in our existing skeleton code base, we first need to add configuration to compile and bundle the frontend code, add the React-related dependencies necessary to build the interactive interface, and tie it all together in the MERN development flow.

Configuring Babel and Webpack

To compile and bundle the client code to run it during development and also bundle it for production, we will update the configuration for Babel and Webpack.

Babel

For compiling React, first install the Babel React preset module as a development dependency:

npm install babel-preset-react --save-dev

Then, update .babelrc to include the module and also configure the react-hot-loader Babel plugin as required for the react-hot-loader module.

mern-skeleton/.babelrc:

{
    "presets": [
      "env",
      "stage-2",
"react"
    ],
"plugins": [
      "react-hot-loader/babel"
    ]
}

Webpack

To bundle client-side code after compiling it with Babel, and also to...