Closed Guria closed 8 years ago
@Guria it's issue for https://github.com/bem/bem-xjst/pull/235
@awinogradov not really sure. xjst vidom engine doesn't fail. it returns string. moreover I can't see a way how it can be expressed as valid array of arguments. I suppose the way to handle string values depends on view package used. :( Correct me if I wrong.
Hmm. Seems React needs at least one root node. Nothing to fix with xjst engine, it works as intended.
var react = require('react')
var reactXjst = require('react-xjst')
var vidom = require('bem-xjst').vidom
var templates = vidom.compile(function(){
block('a')(
tag()(false),
content()('b')
)
})
var bemreact = reactXjst(templates, react)
templates.apply({ block: 'b', content: [{ block: 'a' }, ' text node'] })
// [ 'div', { className: 'b' }, 'b text node' ]
require('react-dom').renderToStaticMarkup(bemreact({ block: 'b', content: [{ block: 'a' }, ' text node'] }))
// '<div class="b">b text node</div>'
The only issue here is a single top level text node. We need to wrap it with span
either here or in xjst
package.
ok, thx. closing here :)
Expected to be
<span>b</span>
withreact@0.14
or plain text node withreact@15.0