Book Image

Modern JavaScript Applications

By : Narayan Prusty
Book Image

Modern JavaScript Applications

By: Narayan Prusty

Overview of this book

Over the years, JavaScript has become vital to the development of a wide range of applications with different architectures. But JS moves lightning fast, and it’s easy to fall behind. Modern JavaScript Applications is designed to get you exploring the latest features of JavaScript and how they can be applied to develop high-quality applications with different architectures. Begin by creating a single page application that builds on the innovative MVC approach using AngularJS, then move forward to develop an enterprise-level application with the microservices architecture using Node to build web services. After that, shift your focus to network programming concepts as you build a real-time web application with websockets. Learn to build responsive, declarative UIs with React and Bootstrap, and see how the performance of web applications can be enhanced using Functional Reactive Programming (FRP). Along the way, explore how the power of JavaScript can be increased multi-fold with high performance techniques. By the end of the book, you’ll be a skilled JavaScript developer with a solid knowledge of the latest JavaScript techniques, tools, and architecture to build modern web apps.
Table of Contents (21 chapters)
Modern JavaScript Applications
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Introduction to React Router


The RSS feed reader application we will create is going to be a single-page application. In single-page applications, routes are defined on the frontend instead of the backend. We need some sort of library that lets us define routes and assign components to them, that is, it can keep the UI in sync with the URL.

React Router is the most popular and recommended routing library for React. It provides a simple API with powerful features such as dynamic route matching and location transition handling built in.

You can find the source code of React Router at https://github.com/reactjs/react-router and the CDN version at https://cdnjs.com/libraries/react-router.

Here is a code sample of how to define routes using React Router and assign components to them:

var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var Link = ReactRouter.Link;
var BrowserHistory = ReactRouter.browserHistory;

var Routes = (
  <Router history={BrowserHistory}>
    <Route path...