2017-08-10 130 views
0

試圖讓反應路由器-DOM和反應,終極版很好地發揮,但在瀏覽器控制檯getitng以下錯誤:React.createElement:類型無效 - 預期字符串

警告:反應。 createElement:type無效 - 期望一個字符串(對於內置組件)或一個類/函數(對於複合組件),但得到:undefined。你可能忘了您的組件從它的定義文件導出。

index.js

import React from 'react'; 
import ReactDom from 'react-dom'; 
import Provider from 'react-redux'; 
import { createStore } from 'redux'; 
import reducer from './src/reducers/Index'; 
import Root from './src/views/Root'; 

let store = createStore(reducer) 

ReactDom.render(
    <Provider store={store}> 
     <Root /> 
    </Provider>, 
    document.getElementById('content') 
); 

減速器(Index.js)

import {combineReducers} from 'redux'; 
import Login from './Login'; 

export default combineReducers({ 
    Login 
}) 

減速(登錄.js)

export default function login(state = 'Login', action) { 
    switch (action.type) { 
    case 'LOGINLOADING': 
     return state + 1 
    case 'LOGINLOADED': 
     return state - 1 
    default: 
     return state 
    } 
} 

Root.js

import React from 'react'; 
import BrowserRouter from 'react-router-dom'; 
import App from './App'; 

class Root extends React.Component { 
    render(){ 
     return (
      <BrowserRouter> 
       <App /> 
      </BrowserRouter> 
     ); 
    } 
} 

export default Root; 

App.js

import React from 'react'; 

class App extends React.Component { 
    render(){ 
     return (
      <div> 
       <p> Hello Kitty </p> 
      </div> 
     ); 
    } 
} 

export default App; 

回答

0

對不起,我固定按照此。

import {createStore} from 'redux'; 

import createStore from 'redux'; 
相關問題