react-nextjs-toast icon indicating copy to clipboard operation
react-nextjs-toast copied to clipboard

Can i use ToastProvider component?

Open Yangeok opened this issue 4 years ago • 1 comments

I want to use toast after registering the provider globally in the App.js, do you have any development plans yet as like below?

const App: React.FC = (): JSX.Element => {
	const options = {
		align: 'left',
		position: 'top',
		id: 'foo-bar'
	}

	return (
		<FooProvider>
			<ToastProvider {...options} >
				<Component />
			</ToastProvider>	
		</FooProvider>
	)
}

Yangeok avatar Oct 05 '20 05:10 Yangeok

I don't have the plan but same can be achieved using the component like this.

const App: React.FC = (): JSX.Element => {
	const options = {
		align: 'left',
		position: 'top',
		id: 'foo-bar'
	}

	return (
		<FooProvider>
			{/* Your component /*} 
			<Component />
                         {/* Toast component /*} 
			<ToastProvider {...options} />	
		</FooProvider>
	)
}```

ashwaniarya avatar Oct 29 '20 13:10 ashwaniarya