0

I can add a button in my toaster of BluePrintJS using React.createElement.

Example:

           Toaster
             .create()
             .show({ 
               message: React.createElement('button', {}, 'MyButton'), 
               intent: 'danger' 
            });

But I am getting an error when I am trying to use normal JSX. Example:

           Toaster
              .create()
              .show({ message: <Button>MyButton</Button>, intent: 'danger' 
            });

Error details- Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead. (no-angle-bracket-type-assertion)

I am getting this error on code editor. And getting parsing error on console.

How can I use JSX instead of React.createElement?

N.B. I am using React Hook

Mithhu
  • 145
  • 1
  • 7

0 Answers0