textwithnewlines

A React Component for turning text with newlines into semantic paragraphs.

Usage no npm install needed!

<script type="module">
  import textwithnewlines from 'https://cdn.skypack.dev/textwithnewlines';
</script>

README

TextWithNewlines

A React Component for turning text with newlines into semantic paragraphs.

Installation

npm install --save textwithnewlines

Usage

import TextWithNewlines from "textwithnewlines";

const sampleText = `The first paragraph

Another paragraph.

A third paragraph`;

class App extends React.Component {
  render() {
    return <TextWithNewlines>{sampleText}</TextWithNewlines>;
  }
}

Which will output:

<div>
  <p>
    First Paragraph
  </p>
  <p>
    Second Paragraph
  </p>
  <p>
    Third Paragraph
  </p>
</div>