Skip to content

Releases: preactjs/preact-render-to-string

2.5.0

04 May 18:24
Compare
Choose a tag to compare
  • Add support for a {pretty:true} option, which outputs formatting whitespace. This release is dedicated to @drastick for his tenure.
prettyRender(
    <section>
        <a href="/foo">foo</a>
        bar
        <p>hello</p>
    </section>
);

// output:
<section>
    <a href="/foo">foo</a>
    bar
    <p>hello</p>
</section>

2.4.0

14 Apr 02:07
Compare
Choose a tag to compare
  • Generate globally unique common names for unnamed components, instead of falling back to "Component".

    Unnamed components are now rendered as <UnnamedComponent0>, where 0 is an internal ID. Two identical components (referentially equal) will render with the same name, useful for testing unnamed components.

  • Don't assume Function.prototype exists (it doesn't for ES2015 arrow functions)

  • Add a renderRootComponent:false option, which skips rendering for components located at the root of the given JSX tree.

    Example:

    render(<Foo>a</Foo>) === '<Foo>a</Foo>'

2.3.0

14 Apr 00:43
Compare
Choose a tag to compare
  • Add sortAttributes option. When set to true, attributes are sorted by name lexicographically during serialization. Useful for testing, such as via preact-jsx-chai

2.2.0

19 Mar 18:44
Compare
Choose a tag to compare

2.1.0

11 Mar 02:33
Compare
Choose a tag to compare
  • Bugfix: Falsey values (false, null and undefined) are no longer incorrectly rendered as strings (Issue #2)

2.0.0

13 Feb 20:21
Compare
Choose a tag to compare

Breaking change: second argument to render() and shallowRender() is now context instead of options. options is now the third argument (see poll).

1.2.0

09 Nov 16:20
Compare
Choose a tag to compare
  • Adds support for managing className VS class.
    • className takes precedence over class
    • either prop will only ever populate the HTML class attribute