
How it Works:
Backend Sends a JSON Contract
Each tool or widget from the backend is described using a clear JSON contract:name
: Identifier for logging or debugging.jsx
: A string representation of a JavaScript function returning a React element.props
: Backend-generated props passed directly to the component.
Frontend Parses and Prepares for Rendering
The frontend receives and parses this JSON structure using a dedicated renderer:Check out DynamicComponentRender code in our GitHub repository for the complete source code.
Isolated Rendering via SingleComponent
Each received component is rendered independently using the SingleComponent renderer, allowing robust error handling:Secure Runtime JSX Execution
The JSX string received from the backend is securely converted and executed as a real JavaScript function at runtime:- JSX strings are dynamically converted into executable JavaScript functions at runtime.
- Protective helper functions like safeSubstring are injected to ensure robustness against unexpected data inputs.
- Backend-generated props are immediately available within the component function as standard React props.