> yarn add nzxt zheleznaya
> mkdir pages
> touch pages/index.tsx
You must create typescript code.
import { h, Component } from "nzxt/h";
interface Props {
stars: number;
}
const Index: Component<Props> = ({ stars }) => {
return (
<h1>nzxt stars: {stars}</h1>
);
}
Index.getInitialProps = async () => {
const json = await fetch("https://api.github.com/repos/naoki-tomita/nzxt").then(res => res.json());
return { stars: json.stargazers_count };
}
> yarn nzxt
You can see on http://localhost:8080