Quick Tip: Reduce some common React boilerplate

If you’re keeping track of a presentational component’s visibility in state, then you normally need to set up an initial state in your constructor and set up click handlers to deal with toggling that visibility. But through the clever use of some ES2015 features, you can get rid of a lot of the overhead you need to construct this. Check out this example:


Pretty neat! That knocked this example component’s size down to about half of the other one. We use the fact that the initial state is falsey if it hasn’t been set to read from a default object. We also use an inline arrow function to toggle the visibility state, rather than extracting it out to a full class method.

This won’t scale if you’re needing to read from state in multiple methods. Nor will it scale if you need your toggle button to do other things. However, for simple components, this can keep you from having to type out as much code as before, which reduces complexity and increases readability when you go to a code review.

Some Code Ideas

I’ve got a bunch of random ideas sitting around in the old mind palace around ways to improve the Javascript ecosystem and libraries. I figure I should get those out before I either forget them or my brain explodes. So, I present you with a wall of text that is hopefully somewhat useful.

A Different Router API

I’m a contributor on react-router, which is a Javascript library to build routes in React apps. Think “pages” in a single page app (SPA). It’s extremely powerful and handles a lot of things, such as asynchronous data loading and code splitting. It’s really, really good and you should check it out if you haven’t already.

However, I was thinking about a way to simplify its use for most users. Here’s a common pattern you’ll see when using it:


This is just the routes isolated in their own file. It makes it easy to reason about the layout of your app’s pages. But it seems like a lot of typing to set up these special Route components that just link you over to your actual React components. What if we didn’t have to do that?


Neat! How do we do something like that? Instead of wrapping the component inside of a Route, the component is created as a router component explicitly:


Why would that be better? One of the more non-obvious features of react-router is that it passes lots of useful props to the Route components, such as this.props.params. However, the component has no guarantees that it’s being used in a route. Practically speaking, that isn’t going to be a problem because you’re in complete control of your code and it would be a weird pattern to expect route props and then not use that component in a route. However, being explicit about your code’s expectations are always a good thing.

In addition, you could potentially access things like params even when your component isn’t being used directly as a route. That information could be passed down via this.context and accessed by any child node under a route.

Of course, this doesn’t take into account more advanced use cases, such as asynchronous routes, but it could be an interesting pattern to explore for simple use cases.

Autoloading Javascript

I’ve written a lot of Rails code. I still do. Ruby is a great language for backend systems and Rails makes it exceedingly simple and terse to whip up a full-featured REST API in no time. I recently tried to do the same in Node and it was like pulling teeth. There was a lot of DIY setup and fiddling just to get things working. Gross. I know things like Adonis exist to make this better, so hopefully its popularity will grow over time.

But one fixable part of the problem was how much space was wasted on explicitly defining imports in every file. Look at the examples above and notice how nearly half the code is imports. This is something Rails solves with a fantastic autoloader so you never have to require a single file in Rails. It’s almost an anti-pattern if you do. Wouldn’t it be great if you could do that in Javascript too? So, the previous routes file might look like this:


A third of the code gone, but even better, we don’t have to edit the code in two places to add another route: once for the import, once for the route itself.

How would one implement something like this? One way might be a plugin to Babel to look up undefined variables and add in import statements to the code dynamically. You might also override on a per-path basis with a .autoload file, which would let the autoloader know to only search in our route components path. In a Redux combineReducers instance, it would have it autoload from the path to your reducer functions.

Webpack Preset

This last one is a little more self-serving. I’ve been (slowly) working on building out more of Webpack Preset. One of the things I don’t like about webpack (and why I always preferred Gulp to Grunt) is its use of a configuration object instead of a configuration API. (Even better, it could offer both!) So, most of my presets end up doing some funky object manipulation and have a lot of redundant code between them.

What I plan on building out in more detail is a configuration API to webpack. Jason Quense has already experimented with this a bit, and I will probably end up poaching bits of it (with credit, of course!). But my thoughts are to make this a separate library so anyone can use it.

One of the most complex parts of it will be allowing us to serialize the constructed config into a webpack.config.js file. How best should you convert a plugin back to a new webpack.optimize.OccurenceOrderPlugin() statement? I’m not 100% sure how, but it could be pretty interesting to find out!

Buffer Overflow

Here’s a trimmed down shot of the header and content footer from Buffer’s blog.

Buffer Overflow

This is what happens when content marketers start optimizing for individual successes instead of a single, cohesive goal.

The focus should be on the singular purpose of driving readers to sign up for the product. Instead they’re pushing for readership with a huge subscription pop-up. They’ve got an advertisement for the upcoming webinar. They’re telling me about the job openings. There are a ton of social action buttons (both for the post and for the author). I’m asked to download their app. But they also want me to sign up for free in seconds. Each one of these things is a small victory for the content marketer. But it often moves one needle at the cost of the overall change they’re trying to effect.

This style of content marketing really only works well for those with diagnosed cases of ADHD. For the rest of us, it’s overkill and turns me off from wanting to sign up for an account. If your content marketing is this schizophrenic, how complex and hard-to-use is your product going to be?

(Note: I am an active Buffer user and do actually like their product.)

Idea: A Modern Job Board

Not sure what to work on next? Need some inspiration? I’ll be posting these startup ideas on a regular basis. My hope is that they’ll help you in some way, but I can’t guarantee their viability or success. You should do your own customer discovery on them and validate a market exists. I could be way off base, but hopefully you’ll discover another problem to be solved in the process.

Job boards are boring, both for those that run them and those that browse them. Look at CareerBuilder, a company that is now 19 years old and still has a website that feels like it’s just as old. Or look at The Resumator, whose big cool features are basically just social link tracking and importing from the LinkedIn API.

And think about the problems of resume management (“fill out your job history in these text boxes and also upload your resume, which has all the same info!”) and searching for job seekers. It’s a full time job trying to get a full time job.

There is seemingly little innovation in the job board space. And there are some very low-hanging fruit to move the space forward. For instance, adding video to the submission form would give great insight into potential candidates. Or you could automatically generate portfolios of work by designers through integration with Dribbble. The same thing can be done for developers with GitHub integration.

A little out-of-the box thinking is all it takes. Look at what Discourse is doing for discussion boards. I think job boards could stand to be brought into this decade too.

A Tesla Road Trip

For this Thanksgiving, my wife and I decided to take a road trip from Atlanta to New Hampshire to stay at my parents’ place. What makes this trip particularly interesting is that we would be undertaking it in a fully electric Tesla Model S. Powering a car by electricity instead of gasoline changes up quite a few things for taking on an 1,100 mile journey. For instance, how do you go that distance in a car that has an advertised 300 mile of range?

This trip was primarily enabled by Tesla’s Supercharger network, which is a series of fast charging stations the company is building throughout the country. They recently completed buildout of stations up the East Coast. The closest to Atlanta was still 340 miles away in Burlington, NC (outside of the 300 mile range of the Model S), but this put it close enough to stop in Greenville, SC overnight to charge on a slower “Level 2” charger. We would then leave the next day and take the Supercharger network the entire way up in one day. At 15 hours of drive time according to Google Maps and even with 4 Supercharger stops at an hour and a half each, the second day of the trip would take 21 hours. We’d get there late, but in one piece.

Unfortunately, I didn’t factor in some important facts and it ended up taking 26 hours. However, the car performed as well as it could despite my failings. And I learned some key facts for both our trip back home this weekend and future road trips.

Fact #1: Avoid Bad Weather

I had booked our hotel in Greenville a couple weeks before our trip. Big mistake. The day we planned on taking the big trip also coincided with a big Nor’easter making it’s way up the coast along with us. That brought cold temperatures and rain, both of which eat up much of the expected range.

One thing to note here is that while the car can get the advertised 300 mile of range under ideal conditions, there is a default “Rated” range of 265 miles, which comes from the EPA’s testing of the car. (In addition, the most recent Model S software version (5.8) changes the range calculation to “hide” about 10 miles from the displayed range). The rated range is really what you should base your expectations on. You should get that performance when driving at 60MPH in clear weather.

But what about bad weather? ChadS over on Tesla Motors Club posted some calculations he’s worked on to determine the effects of various conditions on range. He’s found that rain adds up to 10% more used miles of range when driving. For example, if you’re going 200 miles with 250 miles of rated range in the car, you’d normally expect to end up with 50 miles left. In the rain, that would use up 220 miles, leaving 30 miles remaining.

We were also driving in temperatures ranging from 33º to 50º F. This can cut out another 13-7%, or 26 to 14 additional miles. I kept our heat usage low (66-68ºF) to avoid a lot of this loss. This was offset a bit by having to use the defroster to keep visibility.

I left Greenville with 258 miles of range and made it to Burlington with 22 miles left. It was a 201 mile trip, but I used up 236 miles of range, or a 17% increase in usage! What’s interesting is while I planned on driving at 65 MPH along the road, I found it dangerous to maintain those speeds with that much rain on the road. So, while there was the expectation of taking on a higher speed and cutting about an hour and 15 minutes (or one Supercharger stop) off the trip, I couldn’t safely take advantage of that. Rain has a double-whammy effect of reducing range and also making your trip longer. Avoid it at all costs!

Fact #2: Avoid Bad Traffic

Our 2nd Supercharger stop was in Glen Allen, VA, just outside of Richmond. We arrived there around 4pm and left at 5:30pm to continue on to Newark, DE. For those that live or commute along 95 between Richmond and Washington know how much of a terrible, terrible strip of road that can be. And doing it at rush hour? I think I must have been insane.

Luckily, we missed most of the rush hour traffic in DC, where is particularly bad. In addition, the effects on range were extremely minimal. Keep in mind, the Model S’s best range is reached at ~25 MPH, so slowing for traffic doesn’t use additional range. Even with stop-and-go traffic, the low speed kept energy usage minimal.

The much bigger effect was on time. With no traffic, that leg of the trip should have taken about 3 and a half hours. It ended up taking over 5. We added almost 2 hours on to our trip time.

Unfortunately, there isn’t really a very good solution to this problem right now. If it’s possible to bypass traffic, you should take it. However, you should try to time your trip so you won’t be in a major metropolitan area during rush hour. Weekends are preferable, as there is no rush hour.

Fact #3: Superchargers Slow Down

While Tesla’s Superchargers are capable of delivering 120kW of power, which should provide a 50% charge in about 20 minutes. However, that slows to 80% in 40 minutes and 100% in 75 minutes. The rolling graph on Tesla’s Supercharger page shows this off well:


The net effect is you should expect about 90 minutes to fully charge on the Supercharger.

At the beginning, I was getting upwards of 280 miles of range per hour. I found I was at 200 miles of range after about 45 minutes. That is the approximate distance between each East Coast Supercharger. Leaving at that point would save us 45 minutes of charge time, but we would have to go 60 MPH to make it safely. Conversely, if we wait out the full 90 minutes, we would be able to go upwards of 75MPH, which would save about 40 minutes of time. So, neither methodology has a real time advantage.

However, leaving with no wiggle room with your range is a recipe for disaster. What if you take a wrong turn? What you need to stop for an emergency? There are tons of unforeseen issues that could crop up, resulting in you needing additional range when you don’t have it. I’d say to err on the side of caution and lose the additional 5 minutes of travel time to have a far less stressful trip. This is what we did for our trip.

Fact #4: Always Do the Math

I’ve done a road trip before, but without the advantage of the Supercharger network. It was a trip in March from Atlanta to Savannah, which is about 260 miles. This was in a relatively mild climate (I had minimal AC running the whole way) on flat ground driven at a constant 55MPH with cruise control on. I arrived with approximately 40 miles of range remaining, meaning I achieved the advertised 300 miles of “ideal” range that one would expect.

While on that trip, the one thing I focused most on was my Wh/mi meter. This is the amount of power used per mile, and is roughly equivalent to MPG in a gas car. The Model S displays this number as an average for the time since your last charge and for two resettable trip counters. In addition, there is a graph “app” on the touchscreen that can show the value over the last 5, 15, and 30 miles. To get the “ideal” range you need to keep your number at 283 WH/mi and for “rated” range you need 320 Wh/mi.

Unfortunately, the number is displayed in the car only accounts for the power used by the drivetrain, not any accessories or HVAC. While driving in a mild climate, such as Georgia in March, this isn’t an issue because your HVAC usage is low. But when driving in the cold with rain, HVAC usage goes up while remaining hidden from the displayed numbers. I had to start doing a new type of math for this trip.

I figured out quickly that the numbers weren’t working. Luckily, I was smart enough to start off each leg with conservative driving: only go 55MPH and keep the temperature setting relatively low. Once you’re sure it’s safe and you’ve got the range to spare, increase speed and HVAC usage slowly to find a happy medium. Much like topping off at the Superchargers, this is the safest way to road trip. And thanks to this, I found the numbers weren’t lining up and didn’t have to worry about compensating.

What I found worked best was to instead take the range meter from the car and subtract the distance remaining to my destination. Most of the Supercharger locations on the East Coast are 200 miles apart and topping off meant about 250 miles of range. Subtracting the two gives a 50 mile “buffer” to play with. As I drive, I can look at the navigation to see how far we have left and subtract that from the current range. If I see the range going down faster than the remaining distance, I can start to see if this is going to be an issue and make adjustments to my driving patterns.

I would do this every 10 miles (so the numbers are more even). For example, if I had 150 miles left to travel and the range meter now said 190 miles remain, my buffer would be 40 miles and I would have taken up an extra 10 miles of range than I expected. That means every 50 miles I drive takes 60 miles of range, and a 200 mile trip would take 240 miles of range to complete. You can determine for yourself if that’s “safe” or not and reduce speed or HVAC usage to compensate. I found I was doing a little better than this, despite the rain and cold, so I didn’t often have to adjust my speed (outside of being forced to by the rain).

The Return Trip

We’re heading back tomorrow morning and will be taking all of this into account. There will be an additional change to stop overnight in Glen Allen, splitting the major portion of the trip into two days. That is purely situational, as even an ideal trip time of 21 hours is still a long time to drive and it will be a much easier trip when taken in smaller chunks. This will be a normal part of the trip when the planned Superchargers in either Commerce, GA or South Carolina are built. The stop in Greenville can then be skipped and it will still be a two day trip, just with less driving to do on the 2nd day.

I’ll be real-time tracking the return trip as well. It should be interesting to watch the changes between the two attempts. I will open source both all the code behind the tracking site and the data I’ve collected (thanks to TempoDB!). Hopefully others can find this useful and develop improvements to tracking for future trips.

We hit the road around 10am tomorrow. Thanks for following along!

Idea: Simple Services Marketplace

Not sure what to work on next? Need some inspiration? I’ll be posting these startup ideas on a regular basis. My hope is that they’ll help you in some way, but I can’t guarantee their viability or success. You should do your own customer discovery on them and validate a market exists. I could be way off base, but hopefully you’ll discover another problem to be solved in the process.

A while back I met with a Stanley Vergilis of the eponymously-named Vergilis. He had created a college tutoring marketplace that allowed tutors to post availability and find gigs with a focus on easy scheduling of sessions and building trustworthy reputability. The thing was a hit and he was looking to take it to the next level. The most obvious way of doing this was to go horizontal. Mechanics, handymen, hair stylists, and a zillion other local service providers could all make use of such a service. It’s a hugely lucrative opportunity. But they’re going up against some well-funded startups like Zaarly and Internet mainstays like Craigslist. It’s a tough fight to pick, but I have a sneaking suspicion Stanley and his team can make it happen.

This got me thinking about other types of providers. There are many individuals that provide simple services that may not consider their work a full-time job. Maybe it’s someone that makes quick graphic designs or can provide beauty advice or knows how to translate text or makes silly videos with their webcam. These things can all be done online, and therein lies the core of the idea: create a marketplace for people to provide simple services online. Connect these individuals with potential business creates value for them and for you. Think about Etsy’s size and scope for the handmade goods market, but applied to service providers hidden everywhere in the world. These “micro entrepreneurs” are everywhere and simply need a platform to expose their talents to the world.

This might be considered similar to Amazon Mechanical Turk, but the main difference lies in the complexity of the tasks be performed and the requirement for some skill to exist. It may also be considered similar to TaskRabbit or Exec, but these kinds of services focus on in-person talent across a generalized set of tasks without a need for skill. Together, the biggest difference from both of these types of services is that this is a marketplace. The individual micro entrepreneur is in the spotlight versus being an anonymous drone (or “worker” as Mechanical Turk calls it). This is a key difference and what makes this kind of marketplace special.

Now, this idea isn’t unique or new. There are competitors to look out for. The largest and most obvious is Fiverr. Fiverr’s model is to offer services from their providers at a flat $5 fee (hence the name). This makes in the Twitter of this world, where everything has to fit into one limited box. And while this makes things simple for the purchaser, it also severely limits the scope of what services can be offered. The do offer the ability to add arbitrary “Gig Extras” to any offering, but the base cost will always be $5. What if you’re looking to offer quick web design services, or translate an entire application to multiple languages? Those are hardly $5 services, so this seems to me to be a ripe opportunity.

So, that’s the idea. I offer it freely and without any claim to ownership. Ideas are worth nothing, as is this one and the many others sitting inside my Evernote account. Execution is where there is value. But let me know if you like this idea or have thoughts on how to make it better. I have not done any customer discovery, so I’d be interested to learn the reality of the market. And if you are able to make it successful, make sure to save me a spot under the “bedroom DJ” and “part-time photographer” categories.

The Parallel Entrepreneur

I get asked “what are you up to lately?” a lot by other entrepreneurs. It’s one of our universal “safe” conversation topics: unlikely to be controversial; likely to be interesting.

Nowadays, I usually refer to Billfold as my default answer. (And that’s usually followed by an explanation that we’re not a mobile payments company.) But up until this year, my answer was often more complex. I was a parallel entrepreneur: I was actively working on several companies and projects at the same time. And it was a pretty sizable list:

That doesn’t include my various side projects (both entrepreneurial and personal), or the fact I was engaged this summer and have a wedding to plan. And most of it wasn’t providing me any income. For most entrepreneurs that would be completely insane. And maybe it was insane for me too, but we’ll get to that later.

Operating in Parallel

How does one become a parallel entrepreneur in a way that doesn’t make you want to pull your hair out? It’s a matter of scale: big ideas are bad; small ideas are good. I’ll probably go into this more in another post, but suffice to say, small ideas mean you can be more nimble with your customer discovery and product development. Big ideas take up too much time, especially in the case of a single founder. You want small ideas so you can context switch quickly and efficiently.

This nimble-ness allows one to maintain an on/off cycle with each of their ideas. Most of the time when you consider running a startup, it’s assumed you’ll be “on” all the time. 16 hour days talking with customers, building product, reading bug reports, keeping an eye on competition, etc. But small ideas compress a lot of this in a tighter loop, which is where you can be too nimble. Iterating too fast is a bad thing. You need a statistically significant amount of data to ensure your changes are actually having the impact they appear to be having. For instance, your fancy new landing page launches and you see a double-digit percentage increase in conversions. Excellent! But that traffic is coming mostly from a targeted Google Group you posted in. How is it going to perform when your visitors are coming in from AdWords or other traffic sources? You won’t know until a few days from now when your ad campaigns have brought in enough traffic to measure against. You’ve reached an “off” state. This is the parallel entrepreneur’s time to shine.

While idea #1 is gathering data, it’s the perfect opportunity to start developing idea #2. Or #3. Or #8. As a repertoire of ideas starts to build up, certain efficiencies can be achieved. Customer discovery sessions can apply to multiple ideas at once and the kind of serendipitous discoveries that occur during these sessions can increase. And while certain ideas may be “off” at any point, you are personally “on” almost all the time. Productivity will likely be at its maximum.

Keeping it in Check

And now you’re firing on all cylinders. You’ve got a collection of ideas, each progressing towards a successful result. You’ve learned some cool ways to have ideas #2 and #4 interact, and they may even combine into one product. You learned something cool about idea #1 while doing a discovery session for idea #3. Maybe you’ve even got one or two of these ideas bringing in some money. This is all good stuff.

But it’s not all going to be sunshine and rainbows. If your customer discovery sessions are being done properly, you’re going to shut down some ideas early on that either don’t have a market wanting them or are too infeasible to accomplish. But what about the ideas that limp along and just won’t die? These “zombie” ideas can drain the life out of you. The lean methodology of “fail fast” applies very directly to this kind of situation. You should have a pipeline of ideas ready to go once you have sufficient time to commit to it. And as a result, the loss of an anemic idea shouldn’t be significant, will happen often, and will be an easy decision to make. It can be revitalizing to have something new to work on, and that can be what sustains productivity and enthusiasm.

David Cummings wrote a daily post about running “zombie companies” (which actually inspired this writing) that comes from the perspective of the serial entrepreneur. While his definition of a zombie differs from my own, the core sentiment is the same. Successful parallel entrepreneurship is based around effective time management and constant change. If you’re not able to drop dead weight easily, you may be headed towards crushing failure. Don’t be afraid to move on.

The Path to Success

Where is this all headed? There are a few different directions, all of which depend on your definition of success. No single one is the “right” way to handle the situation, and there can be a myriad of external factors that affect your decision.

The most obvious result is switching back to serial entrepreneurship. One idea becomes the obvious breadwinner and takes on a life of it’s own. It begins to push out the other ideas and demands attention of its own. This may happen after a short stint as a parallel entrepreneur, and it’s OK to throw some things at the wall and see what sticks. Handling the dismissal of your other ideas gracefully can either mean shutting down those projects completely or passing them on to others. I would not recommend keeping them running on the side (which is in line with David’s view), as the distraction is not worth it. You’re switching to running a single company, so other distractions can be disastrous. Either sell them off to someone that will take good care of them, or shut them down completely. If you’re willing to shed weak ideas as a proper parallel entrepreneur, this should be easy.

Another path to success is to simply find the right mix of ideas that generate revenue and are sustainable in the long term. This makes you into a “sweat investor”, whereby you are investing time and effort into these companies to turn a profit, rather than just cash. To be honest, this kind of success is rare. Not because it is infeasible, but because it is often not sufficient for most people. Many entrepreneurs want to hit it big, so the threshold for a “weak” idea may be much more loosely defined. And the ideas that aren’t completely hitting it out of the park are discarded. But that kind of person is probably going to switch back to serial entrepreneurship anyways. But if running a sustainable enterprise among a portfolio of companies is sufficient for you, more power to you.

Lastly, you may find success in becoming an “idea factory” of sorts. That is, you often germinate simple ideas into larger companies and then sell them off when they reach a sufficient enough maturity to run on their own. I have seen a few individuals obtain this kind of success and it can be quite fulfilling. It does require a special kind of person that’s willing to separate out emotional attachment to their ideas for the sake of selling them off to others. One of the most common groups that unknowingly does this on a regular basis are small development shops. Particularly the ones that go beyond just simply being coding warehouses and work with their clients to ensure they’re building sustainable businesses. There are also some of my friends that contract specifically for the development of MVPs. Despite working at the very early stages of these companies, they have seen good success in moving from idea to idea very rapidly.

Why I Switched

But as I stated before, I was a parallel entrepreneur. For me, this path was interesting, engaging, and even rewarding at times. However, it ultimately was not sustainable for me. I took the path to success of switching back to serial entrepreneurship. I ended my time at ATDC in October. Ignition Alley will likely be going through some changes soon. I let my colleagues at Army of Bees take over my role there. I had my roommates move out of one of my houses and I’m planning on selling the other one soon. I simplified everything and moved off the parallel lifestyle. It’s worked out well for me and things are far less stressful in my life now.

Nonetheless, my own experiences aren’t a map for others. Take your own path however you see fit. Maybe it’s parallel, maybe it’s serial, maybe it’s something else entirely. I only know what has worked out for me so far. Perhaps it will change again in the future. I’m still figuring it all out (if one can even “figure out” life). I’ll let you know how it goes.

Back to the Future

So, it’s been a while.

I used to blog back in the day. It’s been roughly 3-4 years since I had a blog in place. Coming back makes me a little nervous. Is my writing up to snuff? Will it be entertaining? Insightful? Worthwhile? I hope I have something worth reading.

But what am I going to write? That’s been rattling around in my head ever since I got a bug to start writing again. My goal is high-quality, long form content. Sure, there may be the occasional quick thought or quote, but I’d like to keep those to a minimum. The main topics are going to be technology startups: Starting off, customer discovery, company building, development (code and business), marketing, design, ideas, and inspiration. It will be mostly Atlanta-specific information, but hopefully it can be useful no matter where you are. I may even do some interviews, if folks around town are up for it.

We’ll see how it goes.