Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/yosuke-furukawa/react-nl2br

Newlines to <br /> for React
https://github.com/yosuke-furukawa/react-nl2br

nl2br react

Last synced: 18 days ago
JSON representation

Newlines to <br /> for React

Awesome Lists containing this project

README

        

react-nl2br
==============

# USAGE

```javascript
const nl2br = require('react-nl2br');
const result = nl2br('aaa\nbbb\nccc\nddd');
console.log(result); // aaa, ReactElement('br'), bbb, ReactElement('br'), ccc, ReactElement('br'), ddd
```

## in jsx

```javascript
const React = require('react');
const nl2br = require('react-nl2br');
var Hello = React.createClass({
render: function() {
return (

Hello {nl2br(this.props.name)}

);
}
});
```

# INSTALL

```
$ npm install react-nl2br -S
```