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>
- Host: GitHub
- URL: https://github.com/worka/react-js-nl2br
- Owner: worka
- Created: 2021-09-27T03:08:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-22T03:05:30.000Z (about 4 years ago)
- Last Synced: 2024-11-04T23:51:26.946Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 47.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 😉