Skip to main content

Function: useClassCreate()

function useClassCreate(stack): (className, classDesc?) => Promise<Class | null>;

Defined in: react/src/hooks/class.ts:28

Hook to create a new Class in a specific stack.

Parameters​

ParameterTypeDescription
stackstringThe name of the stack to create the class in.

Returns​

A callback function to create the class.

(className, classDesc?): Promise<Class | null>;

Parameters​

ParameterType
classNamestring
classDesc?string

Returns​

Promise<Class | null>

Example​

const MyComponent = () => {
const createClass = useClassCreate('my-stack');

const handleCreate = async () => {
const newClass = await createClass('NewClass', 'Description of new class');
if (newClass) {
console.log('Class created:', newClass.name);
}
};

return <button onClick={handleCreate}>Create Class</button>;
};