local p=require(script.Parent.Component)local G=p:extend("\080\117\114\101\067\111\109\112\111\110\101\110\116")G.extend=p.extend function G.shouldUpdate(g,p,G)if G~=g.state then return true end if p==g.props then return false end for p,G in p do if g.props[p]~=G then return true end end for G,g in g.props do if p[G]~=g then return true end end return false end return G
--	A version of Component with a `shouldUpdate` method that forces the resulting component to be pure.

local Component = require(script.Parent.Component)

local PureComponent = Component:extend("PureComponent")

-- When extend()ing a component, you don't get an extend method.
-- This is to promote composition over inheritance.
-- PureComponent is an exception to this rule.
PureComponent.extend = Component.extend

function PureComponent:shouldUpdate(newProps, newState)
	-- In a vast majority of cases, if state updated, something has updated.
	-- We don't bother checking in this case.
	if newState ~= self.state then
		return true
	end

	if newProps == self.props then
		return false
	end

	for key, value in newProps do
		if self.props[key] ~= value then
			return true
		end
	end

	for key, value in self.props do
		if newProps[key] ~= value then
			return true
		end
	end

	return false
end

return PureComponent
