Last active
April 2, 2019 20:30
-
-
Save mfix22/82d742f4efad9757cc826d20f2a5e5af to your computer and use it in GitHub Desktop.
Replace string component
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
export function replaceWithComponent(regex, mapping, s) { | |
const parts = s.split(regex); | |
for (let i = 1; i < parts.length; i += 2) { | |
parts[i] = mapping(parts[i]); | |
} | |
return <Fragment>{parts}</Fragment> | |
} |
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
{"paddingVertical":"56px","paddingHorizontal":"56px","marginVertical":"45px","marginHorizontal":"45px","backgroundImage":null,"backgroundImageSelection":null,"backgroundMode":"color","backgroundColor":"green","dropShadow":true,"dropShadowOffsetY":"20px","dropShadowBlurRadius":"68px","theme":"seti","windowTheme":"none","language":"javascript","fontFamily":"Hack","fontSize":"14px","lineHeight":"133%","windowControls":true,"widthAdjustment":true,"lineNumbers":false,"exportSize":"2x","watermark":false,"squaredImage":false,"preset":null,"loading":false} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment