JSFiddle - React, Tailwind, and code Playground
CoffeeScript
view = new Thorax.LayoutView
setView: (view) ->
view.on 'all', (eventName) ->
$('body').append @name + ': ' + eventName + '<br>'
Thorax.LayoutView.prototype.setView.call @, view
$('body').append '<hr>'
showViewA: ->
@setView new Thorax.View
name: 'A'
template: Handlebars.compile "A"
showViewB: ->
@setView new Thorax.View
name: "B"
template: Handlebars.compile "B"
template: Handlebars.compile """
{{layout-element}}
{{#button "showViewA" class="btn"}}Set View A{{/button}}
{{#button "showViewB" class="btn"}}Set View B{{/button}}
"""
view.appendTo 'body'