Skip to content

ryanvdev/ts-rssr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of contents

Introduction

  • Very fast
  • Renter to pure html

Required - VERY IMPORTANT

Config your tsconfig.json

  • module: CommonJs - Build for nodejs.
  • target: ES2021 - For methods like replaceAll, padEnd, flatMap, etc.
  • jsx: react - Specify what JSX code is generated.

In your code

import React from 'ts-rssr'; // ! IMPORTANT

export interface IHomePageProps {
    // Your code here...
}

export function HomePage(props: IHomePageProps) {
    return (
        <html lang='en'>
            <head>
                <meta charSet='UTF-8' />
                <meta http-equiv='X-UA-Compatible' content='IE=edge' />
                <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                <title>Home</title>
            </head>
            <body>
                <main>
                    {/* Your code here */}
                </main>
            </body>
        </html>
    );
}

Rendering

import React from 'ts-rssr'; // ! IMPORTANT

const pureHtml:string = React.render(HomePage({
    // your props
}));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published