1.0.6 • Published 4 years ago

@nobuti/retemplate v1.0.6

Weekly downloads
6
License
ISC
Repository
github
Last release
4 years ago

retemplate

A template utility to replace strings with jsx elements.

Given a string, replace every {key} with the datakey passed. This can be a function returning a string or a raw string. The result will be an array of strings mixed with jsx elements. The primary use case is similar to using String.prototype.replace except for React.

Usage

import template from '@nobuti/retemplate'

render() { 
  return (
    <div>
      {template("hola {mundo} cruel {mundo} foo {wadus}", { 
        mundo: () => <span>mundo</span>, 
        wadus: "foo" 
      })}
    </div>
  )
}
1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago