local Y=require(script.Parent.Component)local i=Y:extend("\080\117\114\101\067\111\109\112\111\110\101\110\116")i.extend=Y.extend function i.shouldUpdate(h,Y,i)if i~=h.state then return true end if Y==h.props then return false end for Y,i in pairs(Y)do if h.props[Y]~=i then return true end end for i,h in pairs(h.props)do if Y[i]~=h then return true end end return false end return i
--[[
	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 pairs(newProps) do
		if self.props[key] ~= value then
			return true
		end
	end

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

	return false
end

return PureComponent
