@feizheng/react-toast
v1.0.0
Published
Toast for react.
Downloads
5
Readme
react-toast
Toast for react.
installation
npm install -S @feizheng/react-toastupdate
npm update @feizheng/react-toastproperties
| Name | Type | Default | Description | | --------- | ------ | ------- | ------------------------------------- | | className | string | - | The extended className for component. | | value | bool | false | Default value. | | onChange | func | noop | The change handler. | | interval | number | 2500 | The default timer interval; |
usage
- import css
@import "~@feizheng/react-toast/dist/style.scss";
// customize your styles:
$react-toast-options: ()- import js
import ReactToast from '@feizheng/react-toast';
import ReactDOM from 'react-dom';
import React from 'react';
import './assets/style.scss';
class App extends React.Component {
constructor(inProps) {
super(inProps);
ReactToast.init({ interval: 2000 });
}
handleClick = (inEvent) => {
ReactToast.present('I am a toast');
};
render() {
return (
<div className="app-container">
<button className="button" onClick={this.handleClick}>
Show Toast
</button>
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById('app'));
documentation
- https://afeiship.github.io/react-toast/
