Quick Start

Add model to Demo component

Use Model In Component

// src/Demo.tsx

import { kosComponent, useKosModel } from "@coca-cola/kos-ui-components";
import { DemoFactory } from "./models/demo/demo-factory";
export const DemoComponent = () => {
  // create or import a new Demo model with ID demo1
  // set the model name via the options
  const { model, ready } = useKosModel<IDemoModel, IDemoModelOptions>({
    modelId: "demo1",
    factory: DemoFactory,
    options: { name: "demo-name" },
  });

  const isReady = ready && model;

  return isReady ? <div>Model Name: {model.name}</div> : <div>LOADING</div>;
};

// export wrapped component that will listent for changes in kos models
export const Demo = kosComponent(DemoComponent);
Previous
Next
On this page
Java Development
Seamlessly transition from Legacy+ systems to Freestyle microdosing and advanced distributed dispense systems.
UI Development
Using KOS SDKs, integrating Consumer and Non-consumer facing UIs becomes seamless, giving you less hassle and more time to create.
Video Library
Meet some of our development team, as they lead you through the tools, features, and tips and tricks of various KOS tools.
Resources
Familiarize yourself with KOS terminology, our reference materials, and explore additional resources that complement your KOS journey.
Copyright © 2024 TCCC. All rights reserved.