O'Reilly logo

Mastering React by Ryan Vice, Adam Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Application runtime configuration

The appConfig module keeps application-level configuration details all in one place.

File: js/appConfig.js

export default {
  pageSize: 10,
  apiRoot: '//localhost:3000',
  postSummaryLength: 512,
  loadTimeSimMs: 2000
};

At this point in development, only the apiRoot is needed. The other items you see in the source will be used later. The pageSize variable is for the infinite scroll feature we'll implement in Chapter 9, React Blog App Part 4 – Infinite Scroll and Search. The postSummaryLength member is for the summary post descriptions, which appear in post lists in the next chapter. Finally, the loadTimeSimMs is an artificial delay we'll use to get a sense of how the application would feel with non-trivial server communication ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required