ReactTraining / react-history

Manage session history with React
267 stars 23 forks source link

Extract shared code into ProviderHelpers #15

Closed ForbesLindesay closed 7 years ago

ForbesLindesay commented 7 years ago

An attempt at answering your question on twitter. I feel that this being more explicit makes it preferable to mixins. There is still some shared code, but not loads

ForbesLindesay commented 7 years ago

I think #16 is probably a better approach, but I'll leave this here in case you want to review it/decide you prefer it.

ForbesLindesay commented 7 years ago

Having given it a bit more thought, I don't think this approach is a good idea. Although it is a tiny bit less duplicated code, it's much more complex and harder to follow overall.