comty/packages/app/src/hooks/useLayoutInterface.js

13 lines
313 B
JavaScript
Executable File

import React from "react"
export default (namespace, ctx) => {
React.useEffect(() => {
if (app.layout[namespace] === "object") {
throw new Error(`Layout namespace [${namespace}] already exists`)
}
app.layout[namespace] = ctx
}, [])
return app.layout[namespace]
}