ilokesto

Migration

Move from react-hot-toast with minimal mental overhead.

Migration

@ilokesto/toast is designed to feel familiar to react-hot-toast users on the common path.

Import swap

// before
import { Toaster, toast } from 'react-hot-toast';

// after
import { Toaster, toast } from '@ilokesto/toast';

Keep the same mount pattern

<Toaster />

The important difference is that Toaster is also responsible for creating and registering the runtime.

Facade parity

The familiar facade calls stay close:

  • toast()
  • toast.success()
  • toast.error()
  • toast.loading()
  • toast.custom()
  • toast.promise()

Practical differences

  • toast.promise() also accepts () => Promise<T>
  • dismissAll() / removeAll() are not separate methods; call dismiss() / remove() without an id
  • useToaster() is expected to run under a mounted Toaster context
  • transport="top-layer" is an extra capability

toastOptions merge order

  1. global toastOptions
  2. per-type toastOptions.success/error/loading/blank/custom
  3. per-toast call options

Suggested migration order

  1. replace imports
  2. keep your existing toast.* calls
  3. mount <Toaster />
  4. move your toastOptions
  5. adjust advanced custom rendering only if needed

On this page