05. Component Communication

The Problem

Separate business components often need a controlled way to exchange commands or data without tightly coupling their UI trees.

The React Difficulty

React encourages parent-to-child props and child-to-parent callbacks. Across distant components, applications commonly introduce context, state libraries, or another communication layer.

React Approach

function Customer({ onSaved }) {
    function save() {
        // ...
        onSaved(1001);
    }
    return <button onClick={save}>Save</button>;
}

<Customer onSaved={id => console.log(id)} />

MS Approach

ManySet provides a direct runtime-oriented approach for this recurring business-application task.

const customer = await ms.inject("./Customer", "content");
customer.onSaved = id => console.log(id);

Why this way is useful in business applications :

The comparison is intended to show where ManySet supplies a business-application abstraction around a recurring task, while keeping HTML and JavaScript visible and directly usable.

Key Point :

ManySet reduces the amount of framework-specific composition required for this particular task, without requiring the React/Angular mechanism to be represented as inherently wrong or incapable.