1
1
mirror of https://github.com/c8r/x0.git synced 2024-09-11 21:57:26 +03:00

Merge defaultProps in static render

This commit is contained in:
Brent Jackson 2017-11-06 10:28:57 -05:00
parent be47b0ba56
commit 3b4ca8510f
3 changed files with 7 additions and 7 deletions

View File

@ -129,7 +129,8 @@ App.defaultProps = {
'Routing with react-router',
'Works with CSS-in-JS libraries like styled-components',
'Support for async data fetching',
]
],
// routes: [ '/', '/hello', '/hi' ]
}
App.getInitialProps = async ({ Component, html, pathname }) => {
@ -138,7 +139,7 @@ App.getInitialProps = async ({ Component, html, pathname }) => {
return {
hello: 'hi',
css,
css
}
}

View File

@ -82,10 +82,12 @@ const writePage = async (Component, options) => {
return html
}
const createStatic = async (filename, options) => {
const createStatic = async (filename, baseOptions) => {
const req = require(filename)
const Component = req.default || req
const options = Object.assign({}, Component.defaultProps, baseOptions)
let html
if (options.routes && options.routes.length) {
html = await options.routes.map(async pathname => {

View File

@ -49,10 +49,7 @@
},
"x0": {
"title": "Compositor x0",
"_basename": "/x0",
"routes": [
"/"
]
"_basename": "/x0"
},
"ava": {
"files": [