React: <pre> tag doesn't preserve line breaks

Created on 5 Oct 2018  路  1Comment  路  Source: facebook/react

<pre> formatted text </pre> doesn't seem to work as intended, it preserves spaces but not line breaks.

Example code:
https://codesandbox.io/s/k2r24k2nrv

Most helpful comment

Please see here: https://reactjs.org/docs/jsx-in-depth.html#children-in-jsx

React doesn't treat <pre> specially in JSX.

You can, however, pass a string literal if you want: https://codesandbox.io/s/8x41w64350

>All comments

Please see here: https://reactjs.org/docs/jsx-in-depth.html#children-in-jsx

React doesn't treat <pre> specially in JSX.

You can, however, pass a string literal if you want: https://codesandbox.io/s/8x41w64350

Was this page helpful?
0 / 5 - 0 ratings