Skip to content

Releases: preactjs/preact-render-to-string

3.1.1

30 Sep 18:13
Compare
Choose a tag to compare
  • Add special treatment for style and class DOM attributes to match DOM renderer

3.1.0

20 Sep 23:45
Compare
Choose a tag to compare
  • Add support for disabling function and/or function name comparison in JSX mode
    • { functionNames:false } just serializes all function props as prop={Function}
    • { functions:false } turns off function serialization entirely
  • Add skipFalseAttributes option - when set to false, turns off DOM attribute skipping (#4)

3.0.7

20 Sep 23:44
Compare
Choose a tag to compare
  • Dont use self-closing tags in JSX mode

3.0.6

20 Sep 23:44
Compare
Choose a tag to compare
  • Fix JSX rendering being non-deterministic about empty VNodes

3.0.5

03 Aug 22:58
Compare
Choose a tag to compare
  • JSX Mode: skip attributes with null and undefined values
  • JSX Mode: don't use self-closing tags as they make string assertions less useful

3.0.2

03 Aug 00:48
Compare
Choose a tag to compare

TL;DR: 3.0.0's {jsx:true} option has been replaced with preact-render-to-string/jsx.

3.0.0 added support for test-style JSX rendering (complex attributes rendered out using pretty-format). However, pretty-format actually doubled the size of preact-render-to-string and broke support for Node 4 and prior.

Instead of adding weight to the core library, which is often used in browsers (this library is part of preact-compat, for example), it's better to support these two "modes" via separate entrypoints into the module.

Here's the new solution - the library is now split into two different entrypoints, one for HTML/XML rendering, and the other specialized entry for JSX-style debug rendering.

Normal Mode

import renderToString from 'preact-render-to-string';

JSX-Style Mode (for test frameworks, debugging, etc)

import renderToString from 'preact-render-to-string/jsx';

3.0.0

02 Aug 23:15
Compare
Choose a tag to compare
  • Add a { jsx:true } mode, which uses pretty-format to render complex JSX-style attribute values. This is useful for debugging purposes, and for preact-jsx-chai

2.8.0

29 Jul 20:47
Compare
Choose a tag to compare

Fixes

  • #7 - Serialize object style attributes to style strings. Thanks @rmales!

Preact 5.2+ started passing Object style props through to the DOM better rendering performance, but that broke renderToString(). This fixes it!

Features

  • #6 - Invoke componentWillMount() for stateful components just before render(). Thanks @mikestead!

2.7.0

22 Jul 16:33
Compare
Choose a tag to compare
  • Add support for defaultProps on both pure and class components (#5)

2.6.1

22 Jul 16:33
Compare
Choose a tag to compare
  • Skip children, key and ref attributes when rendering to HTML.