Skip to content

Instantly share code, notes, and snippets.

@kenmazaika
Created October 7, 2016 02:40
Show Gist options
  • Save kenmazaika/267945cb3d3fedcdb6a307ebd2235cb8 to your computer and use it in GitHub Desktop.
Save kenmazaika/267945cb3d3fedcdb6a307ebd2235cb8 to your computer and use it in GitHub Desktop.

Engineering a Content-Hub with Rails API and React, Redux & WebPack

Traditional blogging engines, like Wordpress, treat the content of a blog post as the most important element of the page. Other elements, like widgets and plugins are often disjointed and second class citizens in comparison to the content itself. A wide array of plugins exist in Wordpress, but getting them to work perfectly can be a challenge.

Breaking the problem down I decided that a blog post could be a collection of BlogPostComponents (and the content of the post is just one such component) and set off to build a JSON API in Rails that could be consumed by a React front-end to be the ulitmate user experience on the blog.

This project is an interesting case study in building a production ready react app, including a number of gotchas along the way.

I'll start with a brief high-level overview of React and Redux for people unfamiliar with the concepts, and explain the application logic code. I then will dive into the more advanced gotchas I encountered.

  • Converting the app to universal (aka isomorphic) for SEO using asyncConnect
  • Managing meta tags with react-helmet
  • Extensive use of ReactDOM to interact with browser events
    • Animation of PostComponents on certain scroll events
    • Capturing link clicks from dangerouslySetInnerHTML content
  • Page Transition Animations
  • Deploying an hosting with PM2 and DigitalOcean

The configuration and setup was a nightmare but now coding on the project is super fun. After everything is said and done, I'm not sure I would go through the trouble, but having said that coding on the project is an absolute blast now.

wat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment