我已经修改了MERN堆栈http://mern.io/,以支持DApp。我正在尝试按以下方式删除应用程序中的页面。
HomePage.js
const HomePage = () => (
<div>
<div>
<h1>Home Page</h1>
<p>
This is the home page for our limitless application.
Let's tell the users here what we are about and explain
how the application works...briefly. This would also be
a good place to check and make sure that metamask is installed,
and to let them know that they will need it.
</p>
</div>
<Home />
</div>
);
export { HomePage };
我收到以下错误 TypeError:无法读取未定义的属性“需要” 在/usr/src/app/server/util/fetchData.js:9:21 该问题似乎是堆栈附带的以下代码的一部分。
fetchData.js
/*
Utility function to fetch required data for component to render in server side.
This was inspired from https://github.com/caljrimmer/isomorphic-redux-app/blob/73e6e7d43ccd41e2eb557a70be79cebc494ee54b/src/common/api/fetchComponentDataBeforeRender.js
*/
import { sequence } from './promiseUtils';
export function fetchComponentData(store, components, params) {
const needs = components.reduce((prev, current) => {
return (current.need || [])
.concat((current.WrappedComponent && (current.WrappedComponent.need !== current.need) ? current.WrappedComponent.need : []) || [])
.concat(prev);
}, []);
return sequence(needs, need => store.dispatch(need(params, store.getState())));
}
promiseUtils.js
/**
* Throw an array to it and a function which can generate promises
* and it will call them sequentially, one after another
*/
export function sequence(items, consumer) {
const results = [];
const runner = () => {
const item = items.shift();
if (item) {
return consumer(item)
.then((result) => {
results.push(result);
})
.then(runner);
}
return Promise.resolve(results);
};
return runner();
}
有人可以帮助我了解这里的问题以及其他代码到底试图做什么吗?我仍在学习反应,所以请保持温柔