1
讀取屬性「propTypes」以下是我的陣營組件:陣營酶類型錯誤:無法未定義
import React from 'react'
var PageLeftLower = React.createClass({
render:function(){
return(<a href="#">Quote Requests</a>);
}
});
module.exports = PageLeftLower;
所以,很簡單的作出反應的組成部分。 我剛開始使用Enzyme和Mocha進行測試,並編寫了以下代碼。
import expect from 'expect';
import React from 'react';
import {shallow} from 'enzyme';
import {PageLeftLower} from './PageLeftLower';
describe('Component : WholeTab',() => {
it('renders without exploding',() => {
expect(shallow(<PageLeftLower/>).length).toEqual(1);
});
});
這當我執行它,它輸出以下警告:
Component : WholeTab Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).
,並出現以下錯誤:
TypeError: Cannot read property 'propTypes' of undefined.
任何幫助,高度讚賞。
完美的男人,我想出昨天,但謝謝回答:) –
好消息哥們:) –