Skip to content

Problem with useToast. #536

Answered by ghost
svrem asked this question in Q&A
May 9, 2021 · 1 comments · 24 replies
Discussion options

You must be logged in to vote

You need to use useToasts in a react component. toast should be replaced by Toast.

import { useToasts, Button } from '@geist-ui/react';

const Toast = () => {
  const [, setToast] = useToasts();
  const onClick = () => setToast({ text: 'The Evil Rabbit jumped over the fence.' });

  return <Button onClick={onClick}>Show Toast</Button>;
};

export default Toast;

Replies: 1 comment 24 replies

Comment options

You must be logged in to vote
24 replies
@svrem
Comment options

@svrem
Comment options

@svrem
Comment options

@ghost
Comment options

@svrem
Comment options

Answer selected by svrem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant