Reaction to React

To be perfectly honest, I’ve only taken very brief glances to React.js. Although I’m not a huge fan of javascript in general, I seem to always be working with it. With this new new Github-Dashboard repo, I thought I’d take a stab at it.

Right off the bat, I barely understand what I’m looking at, the pages are based off their respective js files and then their content is shwon with render() . I install, create and throw in an access token as per the instructions and start’er up.
I’m greeted with a welcome page to login, and after that I’m at a blank page with only a menu bar…
This is what I was expecting:

I basically got that, with no content. Obviously it’s because this a new project, m, but for a little bit, I thought I messed up somewhere. I went ahead and ignored this for now and started work on what Issue-25 asks, Pie charts.

After a bunch of googling I was looking at a bunch of examples. We’re using extends React.Component while a bunch of examples are React.createclass({}) . Having found another article, I read that it didn’t matter. Basically Factory pattern vs OOP. For consistency sake, I looked around and found how to translate the examples of createclass to extends React.Component and went ahead throwing code at the wall to see what sticks.

Initial React Pie Chart

Viola after a bunch of googling and fighting the urge to use someone elses pie chart library, I have a pie chart~ Static/Hard coded data, but there’s something in there and its making a pie chart, so I’m happy. To be honest though, I was getting really frustrated with syntax stuff. E.g. For what ever reason, I was trying to put some logic in the return, why? No clue what I was thinking, but it wasn’t working. I also didn’t realize that everything within render() being returned had to be nested in a parent dom element. Made things weird, but I got it in the end, but I figured it was time for a break from this freestyle learning.

I committed what I had, made a pull request and started taking a look at another issue whilst getting comments on the current one. That’ll be with the next blog