pages
views/pages place page components.
in controller, define a method with a View
decorator:
|
|
when visit /some_page
in server side koa-cola will get views/pages/some_page.tsx
as page view to render to client, in client side, webpack will build these router and component into bundle and auto render in browser.
when raised a error like 404 or 500, koa-cola will looking for the correspondent file in views/pages like 404.tsx
or 500.tsx
.
views/pages/layout.ts is as the layout file koa-cola eventually render the page, if the file does not exist, the page component will render directly.
layout.ts by default:
|
|
koa-cola render window.__data
as redux store serialization after </body>
.
|
|
if you don't want a particular page to use layout.ts as the page wrapper, you can use decorator "doNotUseLayout" like this:
|
|
and in this case, you can define the header element and bundle js or other resource like css by using decorator bundle
and header
like this:
|
|