An open API service indexing awesome lists of open source software.

https://github.com/worka/react-js-nl2br

Replacing newline char with <br> in React. Does not generate any extra empty unnecessary lines and <br>
https://github.com/worka/react-js-nl2br

Last synced: 12 months ago
JSON representation

Replacing newline char with <br> in React. Does not generate any extra empty unnecessary lines and <br>

Awesome Lists containing this project

README

          

# react-js-nl2br

Replacing newline char with `
` in React

Does not generate any extra empty unnecessary lines and `
`

### Install

```cmd
npm i react-js-nl2br
```

or

```cmd
yarn add react-js-nl2br
```

### Get started

```javascript
import React from 'react';
import { nl2br } from 'react-js-nl2br';

function Component({ text }) {
return (

{ nl2br(text) }

);
}
```

Do not rush to use this plugin, perhaps this CSS property will help you solve the problem: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space 😉