React-toastify: word wrap

Created on 7 Jan 2018  路  7Comments  路  Source: fkhadra/react-toastify

How i do it?

toast.warn("Error 400\nField text invalid")

\n and <br/> not wrapping text.

Most helpful comment

Hello @neetocode,

You could use jsx instead as follow:

toast.warn(<div>Error 400 <br />Field text invalid<div>)

Quote are not needed with jsx.

All 7 comments

Hello @neetocode,

You could use jsx instead as follow:

toast.warn(<div>Error 400 <br />Field text invalid<div>)

Quote are not needed with jsx.

cool!

How about if we are using .js? How are we going to have a new line

So, How to pass a variable inside toast
for example
var msg= 'Hello World';
i passed this msg varible into toastr like this...
toast.error(<div>msg<div>)

the toaster is showing "msg" not "Hello World".
someone give the right solution pls

@Navaruban you could do as follow:

let msg = "Hello";

toast.error(() => <div>${msg}</div>);

I have a long text like

toast.success("MYSUCCESSMYSUCCESSMYSUCCESSMYSUCCESSMYSUCCESS");

The above text is not getting word wrap. The text is beyond the display part of toast.

Need the second toast to be word wrap

asdfasdfScreenshot from 2020-04-02 20-02-19

I have a long text like

toast.success("MYSUCCESSMYSUCCESSMYSUCCESSMYSUCCESSMYSUCCESS");

The above text is not getting word wrap. The text is beyond the display part of toast.

Need the second toast to be word wrap

asdfasdfScreenshot from 2020-04-02 20-02-19

Did you find any solution for this @fkhadra ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prmichaelsen picture prmichaelsen  路  5Comments

LouisCuvelier picture LouisCuvelier  路  3Comments

fkhadra picture fkhadra  路  3Comments

giocodes picture giocodes  路  3Comments

tobiasfriden picture tobiasfriden  路  3Comments