olahol / react-social

Simple React components for social buttons (Facebook, Twitter and Pinterest) and social counts.
177 stars 60 forks source link

Button no more stateless and powerful onclick #45

Closed huvber closed 7 years ago

huvber commented 7 years ago

I made the Button component not anymore stateless and I add all the props as a state properties. In this way the onClickmethod can, eventually, manipulate the state (especially the url). I also allow the onClick method to return a Promise (i.e. if it has to make remote request) or a boolean. For this now the onClick method as to return a valid Promise or a boolean. This could be useful also to control the button behaviour.

olahol commented 7 years ago

I feel like it's better to keep React components as stateless as possible. Perhaps this would work better as a higher order component for react-social? Closing this for now.