A function as child component which provides an interface for creating paragraphs with line breaks from raw text with `\n` new lines. The default render child is: ```js const defaultParagraph = props => <p key={props.key} children={props.text}/> ```
npm install @render-props/paragraphs\n new lines. The defaultjs
const defaultParagraph = props =>
`
$3
`yarn add @render-props/paragraphs` or `npm i @render-props/paragraphs`____
Usage
`js
import Paragraphs from '@render-props/paragraphs'
function MyParagraphs ({text}) {
return (
{({key, text, n, count}) => (
key={key}
className={n === count - 1 ? 'margin--b0' : 'margin--b3'}
children={text}
/>
)}
)
}
MyParagraphs({text: 'foo\n\nbar\n\nbaz\nboz'})
/*
Outputs:
foo
bar
baz
boz
*/
`____
Props
- text {string}
- the text you want to turn into paragraphs with line breaksRender Props
#### State
-
text (value )
- the text in this paragraph with line breaks included
- n
- the current paragraph index
- count`