Requirement is to create component whose methods can be accessible to other component so that from through other component we can give alert massage. ( Like toaster)
I know we can do this by following methods:
statics - React.createClass or static in es6 class.
Using ref of component.
But what is the best way to achieve this?
That would look very funky and wouldn't follow the data-down actions-up React approach.
You could use a render prop instead:
If you need it to be globally available, consider to use something like Redux.