내가 내 Main.jscatch되지 않은 오류 : 요소 유형이 잘못되었습니다 예상 내가 구성하려고 문자열
import React from 'react'
import { Link } from 'react-router'
const Main = (props) => {
return (
<div>
<h1>
<Link to="/">Reduxstagram</Link>
</h1>
{React.createElement(props.children, props)}
</div>
)
}
export default Main
이 내 인덱스가 라우터를 반응하지만,이 이상한 오류
Uncaught Error: Element type is invalid: expected a string.. check render method of Main.
을 얻었다. JS
import Main from './components/Main'
import Single from './components/Single'
import PhotoGrid from './components/PhotoGrid'
//routes
import { Router, Route, IndexRoute, browserHistory } from 'react-router'
const router = (
<Router history={browserHistory}>
<Route path="/" component={Main}>
<IndexRoute component={PhotoGrid}></IndexRoute>
<Route path="/view/:postId" component={Single}></Route>
</Route>
</Router>
)
render(router, document.getElementById('root'));
내가 반응 라우터에 의해 발생할 수 있습니다 생각, 나도 몰라. 내가 간단하게한다면
render(<Main>hi</Main>, document.getElementById('root'));
나는 그것을 볼 수있다. 이상한.
'React.createElement'를 사용하는 방식이 잘못되었습니다. https://facebook.github.io/react/docs/react-api.html#createelement 첫 번째 인수는 문자열이거나 반응하는 구성 요소 –