Chiedo Labs Web Development Harrisonburg VA & Charlottesville VA web design
Picture of Chiedo

How to Use Google Code Prettify With ReactJS


This one will be a short and sweet post. If there is a better way to do this, please let me know. I’m all ears. Simply add the following to the component that you want Code prettify to run for and you’re golden. componentDidMount() { this.runCodePrettify(); } runCodePrettify() { let script = document.createElement(‘script’); script.type = […]

Read more

Picture of Ricardo

1-Minute Guide To “bind” and “this” in React Components


Last night I had a huge ‘connect the dots’ moment. You know, that moment when you realize you were being a ‘doofus’. I thought I understood the concepts of ‘bind’ and ‘this’ in the context of JavaScript; at least a pretty basic understanding. I knew OOP was done differently in JavaScript than in Java or Python so I […]

Read more

Picture of Don

How to Create a Save-All Button with React and Redux


When in the course of developing React/Redux apps, one may verily find him/herself wracking their brain for how to update many separate components in one simple, simultaneous function call. This was the case when one of our clients wanted a CONFIRM ALL button placed on their app. This gave rise to two questions of existential […]

Read more

Picture of Don

Why You Should Define Components Outside of The React Render Method


I just discovered a very annoying bug that took me half an hour to figure out. Here’s what I discovered: NEVER define React components (even dumb stateless components) inside of the React render() method. I had an input field that would lose focus as soon as its value changed. So the userĀ could only enter one […]

Read more

Picture of Chiedo

Setting up JSON Web Tokens using the jwt gem with Devise for a Rails 4 site


This blog post is heavily inspired by this. It didn’t quite work for me so I made some modifications and figured I’d write a post about it. This tutorial assumes that you already have a standard Devise set up on a rails 4 environment. Install the ruby-jwt gem Add the following to your gem file: gem ‘jwt’, […]

Read more

Picture of Chiedo

How to Authenticate Your ReactJS App With Devise. No Gems Needed.


I love using Devise on my Rails projects and love ReactJS but figuring out how to hook the two together was more complicated than I would have liked. So I figured I’d share my findings! Comments and criticisms are always welcome. To preface this post, it makes sense to describe my setup. I’m running a Rails […]

Read more

Picture of Chiedo

How to Create a React App on a Rails API (Without react-rails)


ReactJs is awesome and Ruby on Rails is awesome. Yes, I get that Ruby on Rails is a resource hog and there are much better choices for serving a ReactJs app on that front… but Rails development is fast and when my developers work on Rails projects, they’re productive. So we wanted to throw ReactJS […]

Read more