react-rich-text-template
Text templates parameterized with react components
Why?
Sometimes you need to insert components into strings comes from i18n module.
For example: "Hey, {username}, checkout your profile"
Usage
var rrtt = ; var template = rrtt; ;/*["Hey, anmi, checkout your ", <profileLink>profile</profileLink>]*/
You can redefine string wrapper and set key prop to speedup react elements merge
var rrtt = ; var opts = Object; opts <span =>string</span> var template = rrtt ;/* =>[ <span key=0>template with</span>, <Foo key=1> <span key=0>multiple</span> </Foo> <span key=2>elems</span>]*/
Define processMissingParam to handle missing params.
var rrtt = ; var opts = Object; optsprocessMissingParam = { return <MissingTag>Missing tag: paramName</MissingTag> }; var template = rrtt; ;/* =>[ 'Tag is ', <MissingTag>Missing tag: em</MissingTag>]*/