Getting Started
Learn how to get started with Osmos.
Installation
Install the package using the following command :
npm install npm install @osmosjs/osmos@alphapnpm add yarn add @osmosjs/osmos@alphayarn add yarn add @osmosjs/osmos@alphabun add yarn add @osmosjs/osmos@alphaInside your tsconfig.json, allow usage of "jsx" and specify the jsxImportSource to use Osmos as your JSX runtime:
{
"compileOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@osmosjs/osmos"
}
}Getting Started
Later you will learn the full capabilities of Osmos. For the moment lets render a simple html page with the most simple JSX.
const App = () => {
return (
<html>
<body>
<h1>Hello Osmos users!</h1>
</body>
</html>
)
}
const html = await renderToString(<App />)<!DOCTYPE html>
<html>
<body>
<h1>Hello Osmos users!</h1>
</body>
</html>renderToString can be used to render to string. You can also use renderToReadableStream to
stream content.