react-js-nl2br
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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 😉

Readme

Keywords

Package Sidebar

Install

npm i react-js-nl2br

Weekly Downloads

18

Version

1.0.1

License

ISC

Unpacked Size

4.98 kB

Total Files

6

Last publish

Collaborators

  • worka