import React , { Fragment , ReactNode } from 'react' ; export const nlToBr = ( text ) : ReactNode => text . split ( /\r\n|\r|\n/g ) . map ( ( s , i ) => ( < Fragment key = { i } > { i > 0 && < br />} { s } < /Fragment>));