Created
February 24, 2019 21:34
-
-
Save johnpolacek/8eff5ac6d2ef8f5bca8d9c5c80960a4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
export default (props) => { | |
const words = props.children.split(' ') | |
return <>{words.map((word, i) => word + (i > words.length-((props.widows || 1)+1) ? '\u00a0' : ' ')).join('')}</> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment