UNPKG

nestjs-tsx-views

Version:

Server-side JSX/TSX rendering for your NestJS application 🚀

30 lines • 867 B
import { gql } from '@apollo/client/core/index.js'; import { useQuery } from '@apollo/client/react/hooks/index.js'; import React from 'react'; import { MainLayout } from './layouts/main.js'; const MY_QUERY = gql ` query AllFilms { allFilms { films { id title releaseDate } } } `; const MyView = (props) => { const { data, error } = useQuery(MY_QUERY); if (error) { throw error; } return (React.createElement(MainLayout, { ...props }, React.createElement("h2", null, "Films:"), data === null || data === void 0 ? void 0 : data.allFilms.films.map((film) => (React.createElement("ul", { key: film.id }, film.title, " (", new Date(film.releaseDate).getFullYear(), ")"))))); }; export default MyView; //# sourceMappingURL=my-view.js.map