New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-markup-text

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-markup-text

add <p>s and <br/>s to texts

latest
Source
npmnpm
Version
2.2.0
Version published
Maintainers
1
Created
Source

react-markup-text

markup texts with React

Use this package to add paragraphs and line endings to unstructured text

Install

npm install --save react-markup-text

Usage

import textToReactMarkup from 'react-markup-text';

function BlogArticle({ title, author, body }) {
	return (
		<article className="blog-article">
			<h1 className="blog-article__title">{title}</h1>
			<AuthorBadge author={author} />
			<div className="blog-article__body">
				{textToReactMarkup(body)}
			</div>
		</article>
	);
}

API

textToReactMarkup(text: string) : Array<ReactElement>

The implementation is really simple, \n\n creates a new paragraph and \n a new line.

License

ISC

Keywords

react

FAQs

Package last updated on 24 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts