
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@servlyadmin/runtime-react
Advanced tools
React wrapper for Servly runtime renderer. Render Servly components in your React applications with full support for props, slots, and event handling.
npm install @servlyadmin/runtime-react @servlyadmin/runtime-core
# or
yarn add @servlyadmin/runtime-react @servlyadmin/runtime-core
# or
pnpm add @servlyadmin/runtime-react @servlyadmin/runtime-core
import { ServlyComponent } from '@servlyadmin/runtime-react';
function App() {
return (
<ServlyComponent
id="my-component"
version="latest"
props={{ title: 'Hello World' }}
/>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | Component ID from the registry |
version | string | 'latest' | Version specifier |
props | object | {} | Props to pass to the component |
slots | Record<string, ReactNode> | - | Slot content |
fallback | ReactNode | - | Loading/error fallback |
onError | (error: Error) => void | - | Error callback |
onLoad | () => void | - | Load complete callback |
className | string | - | Wrapper class name |
style | CSSProperties | - | Wrapper styles |
showSkeleton | boolean | true | Show loading skeleton |
cacheStrategy | CacheStrategy | 'memory' | Cache strategy |
eventHandlers | object | - | Event handlers by element ID |
children | ReactNode | - | Default slot content |
import { ServlyComponent } from '@servlyadmin/runtime-react';
function MyPage() {
return (
<ServlyComponent
id="hero-section"
props={{
title: 'Welcome',
subtitle: 'Get started today',
}}
/>
);
}
function CardExample() {
return (
<ServlyComponent
id="card-component"
slots={{
header: <h2>Card Title</h2>,
footer: <button>Learn More</button>,
}}
>
{/* Children go to default slot */}
<p>This is the card content.</p>
</ServlyComponent>
);
}
function InteractiveExample() {
const [count, setCount] = useState(0);
return (
<ServlyComponent
id="counter-component"
props={{ count }}
eventHandlers={{
'increment-btn': {
click: () => setCount(c => c + 1),
},
'decrement-btn': {
click: () => setCount(c => c - 1),
},
}}
/>
);
}
function WithLoadingState() {
return (
<ServlyComponent
id="data-component"
fallback={<div>Loading...</div>}
onLoad={() => console.log('Component loaded!')}
onError={(error) => console.error('Failed to load:', error)}
/>
);
}
function WithCustomSkeleton() {
return (
<ServlyComponent
id="profile-card"
showSkeleton={false}
fallback={
<div className="animate-pulse">
<div className="h-32 bg-gray-200 rounded" />
<div className="h-4 bg-gray-200 rounded mt-4 w-3/4" />
</div>
}
/>
);
}
function VersionedComponent() {
return (
<>
{/* Exact version */}
<ServlyComponent id="my-component" version="1.2.3" />
{/* Version range */}
<ServlyComponent id="my-component" version="^1.0.0" />
{/* Latest */}
<ServlyComponent id="my-component" version="latest" />
</>
);
}
function CacheExample() {
return (
<>
{/* Memory cache (default) */}
<ServlyComponent id="comp1" cacheStrategy="memory" />
{/* Persist to localStorage */}
<ServlyComponent id="comp2" cacheStrategy="localStorage" />
{/* No caching */}
<ServlyComponent id="comp3" cacheStrategy="none" />
</>
);
}
function DynamicPropsExample() {
const [theme, setTheme] = useState('light');
const [user, setUser] = useState({ name: 'Guest' });
return (
<ServlyComponent
id="themed-component"
props={{
theme,
userName: user.name,
timestamp: Date.now(),
}}
/>
);
}
import { ErrorBoundary } from 'react-error-boundary';
function SafeComponent() {
return (
<ErrorBoundary fallback={<div>Something went wrong</div>}>
<ServlyComponent
id="risky-component"
onError={(error) => {
// Log to error tracking service
logError(error);
}}
/>
</ErrorBoundary>
);
}
Full TypeScript support:
import { ServlyComponent, type ServlyComponentProps } from '@servlyadmin/runtime-react';
interface MyComponentProps {
title: string;
count: number;
}
function TypedExample() {
return (
<ServlyComponent<MyComponentProps>
id="typed-component"
props={{
title: 'Hello',
count: 42,
}}
/>
);
}
The component handles SSR gracefully by rendering the fallback on the server and hydrating on the client.
// Works with Next.js, Remix, etc.
function SSRPage() {
return (
<ServlyComponent
id="ssr-component"
fallback={<div>Loading component...</div>}
/>
);
}
cacheStrategy="localStorage" for components that rarely changeimport { useMemo, useCallback } from 'react';
function OptimizedExample() {
const eventHandlers = useMemo(() => ({
'btn': {
click: () => console.log('clicked'),
},
}), []);
return (
<ServlyComponent
id="optimized"
eventHandlers={eventHandlers}
/>
);
}
MIT
FAQs
React wrapper for Servly runtime renderer
The npm package @servlyadmin/runtime-react receives a total of 13 weekly downloads. As such, @servlyadmin/runtime-react popularity was classified as not popular.
We found that @servlyadmin/runtime-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.