39. Modern JavaScript and Vanilla JavaScript Integration
The Problem
Business developers often still need direct access to native HTML elements, browser APIs, and existing JavaScript libraries.
The React Difficulty
React encourages UI updates through state and refs. Direct DOM access is possible, but developers normally use `useRef` and effect timing to interact with native elements.
React Approach
function SearchBox() {
const ref = useRef(null);
function focusSearch() {
ref.current?.focus();
}
return <input ref={ref} />;
}
MS Approach
ManySet provides a direct runtime-oriented approach for this recurring business-application task.
ms.id("txtBox1").value = "Apple";
ms.id("board1").addEventListener("click", f);
ms.el.button("b2").onclick = () =>
ms.inject("./b", "a");
ms.id("video").play();
ms.id("div").getBoundingClientRect();
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.