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.
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.
I made the
Button
component not anymore stateless and I add all the props as a state properties. In this way theonClick
method can, eventually, manipulate the state (especially the url). I also allow theonClick
method to return aPromise
(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.