Last active
October 20, 2022 19:53
-
-
Save mxro/9af41d6950dbe873cf023ba933ac686e to your computer and use it in GitHub Desktop.
react1.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { SSRHandler } from '@goldstack/template-ssr'; | |
import { renderPage, hydrate } from './../render'; | |
const Posts = (props: { posts: string[] }): JSX.Element => { | |
return ( | |
<> | |
<p>Posts:</p> | |
{props.posts.map((p, idx) => ( | |
<div key={idx}>{p}</div> | |
))} | |
</> | |
); | |
}; | |
// eslint-disable-next-line @typescript-eslint/no-unused-vars | |
export const handler: SSRHandler = async (event, context) => { | |
return renderPage({ | |
component: Posts, | |
appendToHead: '<title>Posts</title>', | |
properties: { | |
posts: ['post1', 'post2', 'post3', 'posts4'], | |
}, | |
entryPoint: __filename, | |
event: event, | |
}); | |
}; | |
hydrate(Posts); | |
export default Posts; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment