import React from 'react' ; import { mountComponent } from '../../utils/mountComponent' ; import { Toast } from './Toast' ; function show ( content , type , duration = 2000 ) { mountComponent ( < Toast content = { content } type = { type } duration = { duration } / > ) ; } export const toast = { show , success ( content , duration ? ) { show ( content , 'success' , duration ) ; } , fail ( content , duration ? ) { show ( content , 'error' , duration ) ; } , loading ( content , duration ? ) { show ( content , 'loading' , duration ) ; } , } ;