Extending an existing stateful component in Roact?

I’m trying to make a GUI system where there is a base window component, that can be used to make windows with stuff in them (like a shop or some stats). It has code for dragging and closing the window, and I don’t want to rewrite it everywhere.

To do this, I make a base window component with all the code, then I am extending that component to make new windows. However…

These are the first 2 lines:

return function(Roact, Elements, WindowAPI)
	local WelcomeWindow = Elements.Window:extend('WelcomeWindow')

How would I extend an existing component?