Saturday, June 9, 2018

Rails 5.2 SPA with React.js, Server-side Rendering, and Code Splits


Building on a prior tutorial implementation, I've expanded the functionality of a Rails application so that it is a SPA (Single Page Application). It uses React.js 16, and supports server-side rendering using the react-rails gem.


It also uses React Router to handle navigation between root, or top-level, components.

Server-side rendering makes things pretty difficult in a Rails application. I've had to do some research to get my server-side rendering to work as one would expect.

Dynamic loading of code splits is also something that is difficult to do, but my sample application does support this. The code splits are created using Webpack and the Javascript library react-loadable (not the latest version - I must use an older version of react-loadable to achieve server-side rendering that short-circuits dynamic imports).

The application is a mock Purchase Order tracking application. Items are available to be sold to customers. One can set item prices, and create and edit purchase orders that represent purchases of certain sets of the available Items in the inventory.

Data in the application is predominantly synthetic, and generated using the Faker gem.

This application is deployed to production at reactexperiments.herokuapp.com/. It is indeed hosted on Heroku as a free-tier application.

The Trello page for ToDos on this application is here.

The source code for this application is browsable on Github here.

Monday, April 9, 2018

React.js and Rails 5.1 tutorial implementation

This tutorial is a React.js tutorial from a couple of years ago.

I've completed an implementation of its specification, or goal, here on my Github account.

Saturday, December 10, 2016

Bertrand Russell on Plotinus

...the army had become conscious of its power, and had adopted the practice of choosing emperors in return for monetary rewards, and assassinating them afterwards to give occasion for a renewed sale of the empire... 
...Of all this there is no mention in the works of Plotinus. He turned aside from the spectacle of ruin and misery in the actual world, to contemplate an eternal world of goodness and beauty... 
...In an age such as that in which he lived, unhappiness is immediate and pressing, whereas happiness, if attainable at all, must be sought by reflection upon things that are remote from the impressions of sense. Such happiness has in it always an element of strain; it is very unlike the simple happiness of a child. And since it is not derived from the everyday world, but from thought and imagination, it demands a power of ignoring or despising the life of the senses. It is, therefore, not those who enjoy instinctive happiness who invent the kinds of metaphysical optimism that depend upon belief in the reality of a super-sensible world. Among the men who have been unhappy in a mundane sense, but resolutely determined to find a higher happiness in the world of theory, Plotinus holds a very high place. 
- Bertrand Russell, A History of Western Philosophy, 1946

I disagree.