Why React.js

Over the weekend I was at Dev Center‘s Round Table (free wine + meet other devs) and I got into a discussion with Tunde from Andela about why I don’t like Angular.

The crux of my argument was Angular’s not necessarily solving the hard parts of building for the browser; they give their flavor of things that help but they don’t address the real problems developers face working in the browser.

On Sunday morning Quora asked me if I could answer a question about the most elegant solution on ToDoMVC.

Both questions boil down to “Why do I pick React.js over front-end frameworks?”

I wrote a pretty in-depth answer on Quora which the question author liked and thanked me for.

Check it out and let me know what you think:

https://www.quora.com/Which-framework-library-solves-the-ToDoMVC-widget-most-elegantly/answer/Uzo-Olisemeka

Just React.js Please

Ever since I laid eyes on React.js I fell in love with it. In fact, I was already writing pretty “React-like” HTML+JS at the time, but it was clear that it was many steps ahead of my thinking process.

// sample code of mine at the time

// toggle pushed location state
  state.watch('interface-progress:url-to-use', 'url-to-use', function(msg){
 
    var new_state, url, input, wrapper;
 
      wrapper =  document.getElementById('url-to-use-wrapper');
      input =  document.getElementById('url-to-use');
      new_state = msg.notice.state;
      url = msg.notice.url;
 
    if( new_state === 'reset'){
 
      state.notify('interface-progress:url-to-use', 'disabled');
      input.value = '';
      return;
    }
 
    switch( new_state ){
 
      case 'active':
        removeClass(wrapper, 'hidden');
        input.value = url;
      break;
 
      case 'disabled':
      default:
         addClass(wrapper, 'hidden');
      break;
    }
  });

Make a template of the DOM in Javascript, feed it the required data and React will auto-magically render it as efficiently as possible. The operations behind it is pretty logical, so it’s really more akin to a calculator than a sorcerer’s secret.

My biggest grief with fully adopting React.js is the sheer amount of technology the React community wants you to adopt to use it.

JSX to create your DOM representations. ES6 because its coming. Babel.js because ES6 isn’t here yet. Flux because the people who made React made it, so you’d probably like it too. Webpack. React-Router. The list goes on.

2090035[1]

I came for React.js. I don’t want a JSX transformer or a compile step. All this other stuff I’ll get to when I feel the time is right. In the meantime, show me plain code samples. Javascript only. Not ES6. I can’t use that without a compile step.

If you’re like me and all this other crap is getting in the way, I recommend James Nelson’s Guide to Raw React. Just React and Javascript.

You’re welcome 🙂

 

 

Air Canada Just Stole My Heart

Lufthansa is probably my favorite airline in the world. I love them so much that when I found out they were on strike, I was more concerned about them finding a solution to their problem than mine.

My flight plan started with an Air Canada flight from Toronto to Montreal then Lufthansa to Lagos via Frankfurt. The strike meant I’d be stuck in Montreal if I took the first leg, so I doubled back to the Air Canada desk in Toronto to see what my options were.

It took a little while but the guy at the desk kept me in good spirits with his polite handling of the situation and the occasional joke.

So a guy walks into a grocery store and asks the cashier for half a lettuce. Confused by the request, he carries the lettuce to the back to ask his manager what to do. “Hey boss … some idiot out there wants to buy half of this lettuce”. He heard a gasp and turned around to realize the customer had followed him to the back. “And this gentleman would like to buy the other half”.

He managed to get me booked on an Air Canada flight to Istanbul, then Turkish Airlines to Lagos. All said and done, I’d be getting to Lagos five hours later than my initial flight plan. Awesome!

The Istanbul leg of the trip was pretty uneventful until I tried boarding the flight to Lagos.

I was pulled aside and told there was something wrong with my ticket and I need to go back to the Turkish Air customer care. When I finally found customer care, I was told it was a ticket office issue. I needed to backtrack to before passport control to find the right office to handle the matter. Missed my flight at this point.

Two hours in and nobody has told me exactly what is wrong with my ticket!

In my journey to find the Turkish Air ticket office, I passed by an Air Canada customer service desk and decided to take my chances there.

While he didn’t explain what was wrong with my ticket (maybe its a Turkish thing?), he arranged for me to get on the next flight to Lagos. Unfortunately the last flight for the day was already out, so Air Canada footed the bill for a night at Radisson Blu.

lobby_1440x550[1]

Air Canada paid for transportation to and from, dinner and breakfast as well as my flight home. I needed a visa to go into town for the night, and the Turkish Ground Services member assigned to me handled getting the visa and paying for it. Every detail was taken care of.

In this trip, Air Canada came through for me when my favorite airline let me down. They took over when the airline they handed me to dropped the ball. They were the Star Alliance partner that really came through for me today.

I’m currently in my hotel room typing this up. In the morning I’ll go down for a swim, have breakfast, stroll around Istanbul to take pics and get back to the lobby in time for a chauffeured ride back to the airport to catch my flight to Lagos.

What had all the makings of an unpleasant trip were smoothed away by the attention to detail and level of care afforded me by Air Canada. Would you believe that even through all the changes my bags didn’t get lost? They’re right here with me in the hotel room.

From now on, I don’t think I’ll plan a trip without finding out if I can take Air Canada instead. At least I can be rest assured they’d do their best to make sure I’m not stuck. If it’s unavoidable, I know I’d be comfortable the whole time.


Postscript
Is this love that I’m feeling? Looks like Air Canada is venturing into servicing African routes soon <3