Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save johnpolacek/8eff5ac6d2ef8f5bca8d9c5c80960a4d to your computer and use it in GitHub Desktop.
Save johnpolacek/8eff5ac6d2ef8f5bca8d9c5c80960a4d to your computer and use it in GitHub Desktop.
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