1.0.1 • Published 2 years ago

react-js-nl2br v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

react-js-nl2br

Replacing newline char with <br> in React

Does not generate any extra empty unnecessary lines and <br>

Install

npm i react-js-nl2br

or

yarn add react-js-nl2br

Get started

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

function Component({ text }) {
    return (
        <div>{ nl2br(text) }</div>
    );
}

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 😉