return function(D)local B=require(script.Parent.Parent.Roact)local c=require(script.Parent.Parent.lib)local z=c.fromInstance(B,script.Parent.assets.wrapped)local G=B.Component:extend("\067\111\117\110\116\101\114")function G.init(D)D:setState({count=0})end function G.render(D)return B.createElement(D.props.template,{CountingButton={Text="\067\108\105\099\107\101\100\058 "..D.state.count;[B.Event.Activated]=function()D:setState({count=D.state.count+1})end}})end local H=0 local function V()H+=1 return B.createElement(z,{TitleLabel={Text="\065 \067\111\117\110\116\105\110\103 \066\117\116\116\111\110 \119\105\116\104 \073\110\116\101\114\110\097\108 \083\116\097\116\101 \040\114\101\110\100\101\114 "..(H.."\041")},CountingButton=c.wrapped(G)})end local u=B.mount(B.createElement(V),D)return function()B.unmount(u)end end
--[[
	Clicked count should go up when clicked, and render count should not.
]]
return function(target)
	local Roact = require(script.Parent.Parent.Roact)
	local RoactTemplate = require(script.Parent.Parent.lib)

	local ExampleTemplate = RoactTemplate.fromInstance(Roact, script.Parent.assets.wrapped)

	local Counter = Roact.Component:extend("Counter")

	function Counter:init()
		self:setState({
			count = 0,
		})
	end

	function Counter:render()
		return Roact.createElement(self.props.template, {
			CountingButton = {
				Text = "Clicked: " .. self.state.count,
				[Roact.Event.Activated] = function()
					self:setState({
						count = self.state.count + 1,
					})
				end,
			},
		})
	end

	local renderCalls = 0

	local function Example()
		renderCalls += 1
		-- If components are working properly, "render 1" won't increase since
		-- the outer object isn't being re-rendered, only the button is!

		return Roact.createElement(ExampleTemplate, {
			TitleLabel = { Text = "A Counting Button with Internal State (render " .. renderCalls .. ")" },
			CountingButton = RoactTemplate.wrapped(Counter),
		})
	end

	local tree = Roact.mount(Roact.createElement(Example), target)

	return function()
		Roact.unmount(tree)
	end
end
