arunoda / react-komposer

Feed data into React components by composing containers.
MIT License
733 stars 70 forks source link

reverse params to onData()? #73

Closed cellog closed 8 years ago

cellog commented 8 years ago

Hi,

as a new user for react-komposer, I ran into a snag. I called onData(props) with no error. The error message was something about passing in an Error object, which was very confusing. It took me 45 minutes to realize I needed to pass in null for an error object.

It seems to me, passing an error is much less likely to be as common as passing in props. Why not reverse the order of parameters, so onData(props) is the default, and onData(props, error) is the way to do that?

MasterAM commented 8 years ago

Actually, the convention for node.js callbacks is sending an error as the first argument and the data as the second, so this pattern is familiar to many of the developers using node.

Here's a nice blog post about it.

arunoda commented 8 years ago

closing as already answered.