/ / React.createElement प्रतिक्रिया राउटर के साथ त्रुटि - जावास्क्रिप्ट, रिएक्टज, प्रतिक्रिया-राउटर

प्रतिक्रिया राउटर के साथ React.createElement त्रुटि - जावास्क्रिप्ट, प्रतिक्रिया, प्रतिक्रिया-राउटर

कोड:

import React from "react"
import { render } from "react-dom"
import { Router} from "react-router"
render((
<Router>
</Router>
), document.getElementById("app"))

त्रुटि देता है:

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass

Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

मैं Babel6 के साथ Browserify का उपयोग कर रहा हूँ - यहाँ का babelrc:

{
"presets": ["es2015", "react"],
"env": {
"development": {
"plugins": [
["react-transform", {
"transforms": [{
"transform": "livereactload/babel-transform",
"imports": ["react"]
}]
}]
]
}
}
}

और पैकेज.जॉन डिप्स:

"axios": "^0.8.1",
"babel-core": "^6.3.26",
"babel-loader": "^6.2.0",
"babel-plugin-react-transform": "^2.0.0-beta1",
"babel-plugin-transform-es2015-arrow-functions": "^6.3.13",
"babel-plugin-transform-react-jsx": "^6.3.13",
"babel-plugin-transform-runtime": "^6.3.13",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"babel-preset-stage-2": "^6.3.13",
"babel-runtime": "^6.3.19",
"babelify": "^7.2.0",
"browserify": "^12.0.1",
"livereactload": "^2.1.0",
"react": "^0.14.5",
"react-addons-linked-state-mixin": "^0.14.5",
"react-dom": "^0.14.3",
"react-hot-loader": "^1.3.0",
"react-mixin": "^1.1.0",
"react-proxy": "^1.1.2",
"react-redux": "^4.0.6",
"react-router": "^1.0.3",
"react-simple-router": "^0.1.6",
"reactify": "^1.1.1",
"redux": "^3.0.5",
"redux-devtools": "^3.0.1",
"redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.1",
"redux-form": "^4.0.7",
"redux-simple-router": "^1.0.2",

विन्यास कॉन्फ़िगर करें:

var props = {
entries: [script],
cache: {},
packageCache: {},
plugin: isProd ? [] : (watch ? [watchify, livereactload] : [livereactload]),
transform: [
["babelify", {
presets: ["es2015", "react"],
plugins: [
["react-transform", {
"transforms": [{
"transform": "livereactload/babel-transform",
"imports": ["react"]
}]
}]

]
}],
[envify, {}]
],
extensions: [".jsx", ".js"],
debug: !isProd,
fullPaths: !isProd // for watchify
}

सुझाव? मुझे इसके साथ GH पर बहुत सारे मुद्दे मिल रहे हैं लेकिन कोई स्पष्ट समाधान नहीं है। यह रेकटर राउटर साइट पर उदाहरणों के ठीक ऊपर लिया गया है, इसलिए सुनिश्चित नहीं है कि मैं इसे काम क्यों नहीं कर सकता। एकमात्र अंतर यह है कि वे वेबपैक का उपयोग करते हैं।

उत्तर:

जवाब के लिए 0 № 1

खैर मुद्दा अजीब था - टिप्पणी के लिए धन्यवाद मैं इसे हल करने में सक्षम था। मेरे पास एक .babelrc साथ ही ए browserify अपने स्वयं के कोलाहल के साथ काम करना। किसी कारण से दोनों ने इस मुद्दे को बनाया। मैंने गुल में एक को नष्ट कर दिया और अब चीजें ठीक हैं। कारण: मेरे पास शून्य विचार है।