reactjs Cannot read property 'keys' of undefined
I am learning reactjs through a tutorial and ran into this error. That says "Cannot read property 'keys' of undefined" My code is very minimal so I assume that it has to do with the structure of the language. Does anyone know the problem and a possible solution?
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.min.js"></script>
<title>ReactJs</title>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
var HelloWorld = ReactDOM.createClass({
render: function() {
return
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
}
});
ReactDOM.render(
<HelloWorld />, document.getElementById('app'));
</script>
</body>
</html>
javascript reactjs key
add a comment |
I am learning reactjs through a tutorial and ran into this error. That says "Cannot read property 'keys' of undefined" My code is very minimal so I assume that it has to do with the structure of the language. Does anyone know the problem and a possible solution?
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.min.js"></script>
<title>ReactJs</title>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
var HelloWorld = ReactDOM.createClass({
render: function() {
return
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
}
});
ReactDOM.render(
<HelloWorld />, document.getElementById('app'));
</script>
</body>
</html>
javascript reactjs key
Did your feet this working?
– JordanHendrix
Apr 17 '16 at 15:32
1
I inserted your script into my app and still got the same error. It made me realize that as suspected the issue seems to be with the version of Babel that I am using. I'm not sure what the issue is but I will try using another version.
– NVA
Apr 18 '16 at 17:35
odd, I just checked this is the one I'm using: cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
– JordanHendrix
Apr 18 '16 at 17:39
The one that you posted actually worked. Much appreciated.
– NVA
Apr 18 '16 at 17:45
1
i just edited my answer, glad it worked, I bet we see this one pop up a bit more on SO, looking into why, thanks for the good question!
– JordanHendrix
Apr 18 '16 at 17:47
add a comment |
I am learning reactjs through a tutorial and ran into this error. That says "Cannot read property 'keys' of undefined" My code is very minimal so I assume that it has to do with the structure of the language. Does anyone know the problem and a possible solution?
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.min.js"></script>
<title>ReactJs</title>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
var HelloWorld = ReactDOM.createClass({
render: function() {
return
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
}
});
ReactDOM.render(
<HelloWorld />, document.getElementById('app'));
</script>
</body>
</html>
javascript reactjs key
I am learning reactjs through a tutorial and ran into this error. That says "Cannot read property 'keys' of undefined" My code is very minimal so I assume that it has to do with the structure of the language. Does anyone know the problem and a possible solution?
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.min.js"></script>
<title>ReactJs</title>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
var HelloWorld = ReactDOM.createClass({
render: function() {
return
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
}
});
ReactDOM.render(
<HelloWorld />, document.getElementById('app'));
</script>
</body>
</html>
javascript reactjs key
javascript reactjs key
asked Apr 17 '16 at 2:20
NVANVA
5772919
5772919
Did your feet this working?
– JordanHendrix
Apr 17 '16 at 15:32
1
I inserted your script into my app and still got the same error. It made me realize that as suspected the issue seems to be with the version of Babel that I am using. I'm not sure what the issue is but I will try using another version.
– NVA
Apr 18 '16 at 17:35
odd, I just checked this is the one I'm using: cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
– JordanHendrix
Apr 18 '16 at 17:39
The one that you posted actually worked. Much appreciated.
– NVA
Apr 18 '16 at 17:45
1
i just edited my answer, glad it worked, I bet we see this one pop up a bit more on SO, looking into why, thanks for the good question!
– JordanHendrix
Apr 18 '16 at 17:47
add a comment |
Did your feet this working?
– JordanHendrix
Apr 17 '16 at 15:32
1
I inserted your script into my app and still got the same error. It made me realize that as suspected the issue seems to be with the version of Babel that I am using. I'm not sure what the issue is but I will try using another version.
– NVA
Apr 18 '16 at 17:35
odd, I just checked this is the one I'm using: cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
– JordanHendrix
Apr 18 '16 at 17:39
The one that you posted actually worked. Much appreciated.
– NVA
Apr 18 '16 at 17:45
1
i just edited my answer, glad it worked, I bet we see this one pop up a bit more on SO, looking into why, thanks for the good question!
– JordanHendrix
Apr 18 '16 at 17:47
Did your feet this working?
– JordanHendrix
Apr 17 '16 at 15:32
Did your feet this working?
– JordanHendrix
Apr 17 '16 at 15:32
1
1
I inserted your script into my app and still got the same error. It made me realize that as suspected the issue seems to be with the version of Babel that I am using. I'm not sure what the issue is but I will try using another version.
– NVA
Apr 18 '16 at 17:35
I inserted your script into my app and still got the same error. It made me realize that as suspected the issue seems to be with the version of Babel that I am using. I'm not sure what the issue is but I will try using another version.
– NVA
Apr 18 '16 at 17:35
odd, I just checked this is the one I'm using: cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
– JordanHendrix
Apr 18 '16 at 17:39
odd, I just checked this is the one I'm using: cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
– JordanHendrix
Apr 18 '16 at 17:39
The one that you posted actually worked. Much appreciated.
– NVA
Apr 18 '16 at 17:45
The one that you posted actually worked. Much appreciated.
– NVA
Apr 18 '16 at 17:45
1
1
i just edited my answer, glad it worked, I bet we see this one pop up a bit more on SO, looking into why, thanks for the good question!
– JordanHendrix
Apr 18 '16 at 17:47
i just edited my answer, glad it worked, I bet we see this one pop up a bit more on SO, looking into why, thanks for the good question!
– JordanHendrix
Apr 18 '16 at 17:47
add a comment |
5 Answers
5
active
oldest
votes
Edit: oddly, after our comments above, I checked to see if it was indeed the babel core version, I am using this one in my fiddle:
https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
The second I switch to your version above I get this:
Uncaught TypeError: Cannot read property 'keys' of undefined
Use React.createClass
not ReactDOM.createClass
and wrap multiple lines of html in parenthesis like so:
Working Example: https://jsfiddle.net/69z2wepo/38998/
var Hello = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text</p>
</div>
)
}
});
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);
9
any reason why Babel version 6 given that error? I had it too then switch to version 5.8.24 error's gone.
– Huy Le
Mar 21 '17 at 8:14
2
I just had the same error and found that the version of Babel for the browser we were using was deprecated. The newest version you can use in the browser is cdnjs.com/libraries/babel-standalone
– Gwater17
Jul 25 '17 at 21:10
1
The version of babel must be less than 6.0.0
– Bhawandeep Singla
Sep 19 '17 at 6:16
add a comment |
Just to be clear, as the other answers are a bit convoluted. The problem was using "babel-core" instead of "babel-standalone". Just look up for a cdn for babel-standalone instead.
https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js
1
This solved my problem! thanks
– Nasir
May 17 '18 at 8:47
add a comment |
Today is my first day with React, and I've faced this issue when I tried to use Babel to transpile the JSX!
The issue is the version you are trying to use, please use this one instead:
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.25.0/babel.min.js"></script>
Don't forget to write type="text/babel"
in the <script>
tag which you will write the JSX in to let Babel transpile it for you, if you don't, you will find this error (As I have faced it too! :D):
Uncaught SyntaxError: Unexpected token <
add a comment |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
This is the version of babel-core which isn't giving me the error as shown below:
If you want to use the latest version, You can use the latest standalone version. (as per 22-Nov-2018)
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
But this gives the following warning :
"You are using the in-browser Babel transformer. Be sure to precompile your scripts for production - https://babeljs.io/docs/setup/"
add a comment |
I haven't worked with React before, but there are a few things that I see that may be causing your issues. First, React.createClass
instead of ReactDOM.createClass
. Second, you need to wrap your html in parentheses:
var HelloWorld = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
);
}
});
This should get it working
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f36672007%2freactjs-cannot-read-property-keys-of-undefined%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Edit: oddly, after our comments above, I checked to see if it was indeed the babel core version, I am using this one in my fiddle:
https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
The second I switch to your version above I get this:
Uncaught TypeError: Cannot read property 'keys' of undefined
Use React.createClass
not ReactDOM.createClass
and wrap multiple lines of html in parenthesis like so:
Working Example: https://jsfiddle.net/69z2wepo/38998/
var Hello = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text</p>
</div>
)
}
});
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);
9
any reason why Babel version 6 given that error? I had it too then switch to version 5.8.24 error's gone.
– Huy Le
Mar 21 '17 at 8:14
2
I just had the same error and found that the version of Babel for the browser we were using was deprecated. The newest version you can use in the browser is cdnjs.com/libraries/babel-standalone
– Gwater17
Jul 25 '17 at 21:10
1
The version of babel must be less than 6.0.0
– Bhawandeep Singla
Sep 19 '17 at 6:16
add a comment |
Edit: oddly, after our comments above, I checked to see if it was indeed the babel core version, I am using this one in my fiddle:
https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
The second I switch to your version above I get this:
Uncaught TypeError: Cannot read property 'keys' of undefined
Use React.createClass
not ReactDOM.createClass
and wrap multiple lines of html in parenthesis like so:
Working Example: https://jsfiddle.net/69z2wepo/38998/
var Hello = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text</p>
</div>
)
}
});
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);
9
any reason why Babel version 6 given that error? I had it too then switch to version 5.8.24 error's gone.
– Huy Le
Mar 21 '17 at 8:14
2
I just had the same error and found that the version of Babel for the browser we were using was deprecated. The newest version you can use in the browser is cdnjs.com/libraries/babel-standalone
– Gwater17
Jul 25 '17 at 21:10
1
The version of babel must be less than 6.0.0
– Bhawandeep Singla
Sep 19 '17 at 6:16
add a comment |
Edit: oddly, after our comments above, I checked to see if it was indeed the babel core version, I am using this one in my fiddle:
https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
The second I switch to your version above I get this:
Uncaught TypeError: Cannot read property 'keys' of undefined
Use React.createClass
not ReactDOM.createClass
and wrap multiple lines of html in parenthesis like so:
Working Example: https://jsfiddle.net/69z2wepo/38998/
var Hello = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text</p>
</div>
)
}
});
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);
Edit: oddly, after our comments above, I checked to see if it was indeed the babel core version, I am using this one in my fiddle:
https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
The second I switch to your version above I get this:
Uncaught TypeError: Cannot read property 'keys' of undefined
Use React.createClass
not ReactDOM.createClass
and wrap multiple lines of html in parenthesis like so:
Working Example: https://jsfiddle.net/69z2wepo/38998/
var Hello = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text</p>
</div>
)
}
});
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);
edited Apr 18 '16 at 17:46
answered Apr 17 '16 at 2:34
JordanHendrixJordanHendrix
8,20852237
8,20852237
9
any reason why Babel version 6 given that error? I had it too then switch to version 5.8.24 error's gone.
– Huy Le
Mar 21 '17 at 8:14
2
I just had the same error and found that the version of Babel for the browser we were using was deprecated. The newest version you can use in the browser is cdnjs.com/libraries/babel-standalone
– Gwater17
Jul 25 '17 at 21:10
1
The version of babel must be less than 6.0.0
– Bhawandeep Singla
Sep 19 '17 at 6:16
add a comment |
9
any reason why Babel version 6 given that error? I had it too then switch to version 5.8.24 error's gone.
– Huy Le
Mar 21 '17 at 8:14
2
I just had the same error and found that the version of Babel for the browser we were using was deprecated. The newest version you can use in the browser is cdnjs.com/libraries/babel-standalone
– Gwater17
Jul 25 '17 at 21:10
1
The version of babel must be less than 6.0.0
– Bhawandeep Singla
Sep 19 '17 at 6:16
9
9
any reason why Babel version 6 given that error? I had it too then switch to version 5.8.24 error's gone.
– Huy Le
Mar 21 '17 at 8:14
any reason why Babel version 6 given that error? I had it too then switch to version 5.8.24 error's gone.
– Huy Le
Mar 21 '17 at 8:14
2
2
I just had the same error and found that the version of Babel for the browser we were using was deprecated. The newest version you can use in the browser is cdnjs.com/libraries/babel-standalone
– Gwater17
Jul 25 '17 at 21:10
I just had the same error and found that the version of Babel for the browser we were using was deprecated. The newest version you can use in the browser is cdnjs.com/libraries/babel-standalone
– Gwater17
Jul 25 '17 at 21:10
1
1
The version of babel must be less than 6.0.0
– Bhawandeep Singla
Sep 19 '17 at 6:16
The version of babel must be less than 6.0.0
– Bhawandeep Singla
Sep 19 '17 at 6:16
add a comment |
Just to be clear, as the other answers are a bit convoluted. The problem was using "babel-core" instead of "babel-standalone". Just look up for a cdn for babel-standalone instead.
https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js
1
This solved my problem! thanks
– Nasir
May 17 '18 at 8:47
add a comment |
Just to be clear, as the other answers are a bit convoluted. The problem was using "babel-core" instead of "babel-standalone". Just look up for a cdn for babel-standalone instead.
https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js
1
This solved my problem! thanks
– Nasir
May 17 '18 at 8:47
add a comment |
Just to be clear, as the other answers are a bit convoluted. The problem was using "babel-core" instead of "babel-standalone". Just look up for a cdn for babel-standalone instead.
https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js
Just to be clear, as the other answers are a bit convoluted. The problem was using "babel-core" instead of "babel-standalone". Just look up for a cdn for babel-standalone instead.
https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js
answered Jan 17 '18 at 22:05
VIBrunazoVIBrunazo
404717
404717
1
This solved my problem! thanks
– Nasir
May 17 '18 at 8:47
add a comment |
1
This solved my problem! thanks
– Nasir
May 17 '18 at 8:47
1
1
This solved my problem! thanks
– Nasir
May 17 '18 at 8:47
This solved my problem! thanks
– Nasir
May 17 '18 at 8:47
add a comment |
Today is my first day with React, and I've faced this issue when I tried to use Babel to transpile the JSX!
The issue is the version you are trying to use, please use this one instead:
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.25.0/babel.min.js"></script>
Don't forget to write type="text/babel"
in the <script>
tag which you will write the JSX in to let Babel transpile it for you, if you don't, you will find this error (As I have faced it too! :D):
Uncaught SyntaxError: Unexpected token <
add a comment |
Today is my first day with React, and I've faced this issue when I tried to use Babel to transpile the JSX!
The issue is the version you are trying to use, please use this one instead:
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.25.0/babel.min.js"></script>
Don't forget to write type="text/babel"
in the <script>
tag which you will write the JSX in to let Babel transpile it for you, if you don't, you will find this error (As I have faced it too! :D):
Uncaught SyntaxError: Unexpected token <
add a comment |
Today is my first day with React, and I've faced this issue when I tried to use Babel to transpile the JSX!
The issue is the version you are trying to use, please use this one instead:
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.25.0/babel.min.js"></script>
Don't forget to write type="text/babel"
in the <script>
tag which you will write the JSX in to let Babel transpile it for you, if you don't, you will find this error (As I have faced it too! :D):
Uncaught SyntaxError: Unexpected token <
Today is my first day with React, and I've faced this issue when I tried to use Babel to transpile the JSX!
The issue is the version you are trying to use, please use this one instead:
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.25.0/babel.min.js"></script>
Don't forget to write type="text/babel"
in the <script>
tag which you will write the JSX in to let Babel transpile it for you, if you don't, you will find this error (As I have faced it too! :D):
Uncaught SyntaxError: Unexpected token <
answered Nov 29 '17 at 2:57
ElharonyElharony
408213
408213
add a comment |
add a comment |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
This is the version of babel-core which isn't giving me the error as shown below:
If you want to use the latest version, You can use the latest standalone version. (as per 22-Nov-2018)
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
But this gives the following warning :
"You are using the in-browser Babel transformer. Be sure to precompile your scripts for production - https://babeljs.io/docs/setup/"
add a comment |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
This is the version of babel-core which isn't giving me the error as shown below:
If you want to use the latest version, You can use the latest standalone version. (as per 22-Nov-2018)
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
But this gives the following warning :
"You are using the in-browser Babel transformer. Be sure to precompile your scripts for production - https://babeljs.io/docs/setup/"
add a comment |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
This is the version of babel-core which isn't giving me the error as shown below:
If you want to use the latest version, You can use the latest standalone version. (as per 22-Nov-2018)
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
But this gives the following warning :
"You are using the in-browser Babel transformer. Be sure to precompile your scripts for production - https://babeljs.io/docs/setup/"
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
This is the version of babel-core which isn't giving me the error as shown below:
If you want to use the latest version, You can use the latest standalone version. (as per 22-Nov-2018)
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
But this gives the following warning :
"You are using the in-browser Babel transformer. Be sure to precompile your scripts for production - https://babeljs.io/docs/setup/"
edited Nov 21 '18 at 23:26
answered Nov 21 '18 at 23:20
devDeejaydevDeejay
750816
750816
add a comment |
add a comment |
I haven't worked with React before, but there are a few things that I see that may be causing your issues. First, React.createClass
instead of ReactDOM.createClass
. Second, you need to wrap your html in parentheses:
var HelloWorld = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
);
}
});
This should get it working
add a comment |
I haven't worked with React before, but there are a few things that I see that may be causing your issues. First, React.createClass
instead of ReactDOM.createClass
. Second, you need to wrap your html in parentheses:
var HelloWorld = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
);
}
});
This should get it working
add a comment |
I haven't worked with React before, but there are a few things that I see that may be causing your issues. First, React.createClass
instead of ReactDOM.createClass
. Second, you need to wrap your html in parentheses:
var HelloWorld = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
);
}
});
This should get it working
I haven't worked with React before, but there are a few things that I see that may be causing your issues. First, React.createClass
instead of ReactDOM.createClass
. Second, you need to wrap your html in parentheses:
var HelloWorld = React.createClass({
render: function() {
return (
<div>
<h1>Hello World</h1>
<p>This is some text></p>
</div>
);
}
});
This should get it working
answered Apr 17 '16 at 2:37
Alex RAlex R
548210
548210
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f36672007%2freactjs-cannot-read-property-keys-of-undefined%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did your feet this working?
– JordanHendrix
Apr 17 '16 at 15:32
1
I inserted your script into my app and still got the same error. It made me realize that as suspected the issue seems to be with the version of Babel that I am using. I'm not sure what the issue is but I will try using another version.
– NVA
Apr 18 '16 at 17:35
odd, I just checked this is the one I'm using: cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js
– JordanHendrix
Apr 18 '16 at 17:39
The one that you posted actually worked. Much appreciated.
– NVA
Apr 18 '16 at 17:45
1
i just edited my answer, glad it worked, I bet we see this one pop up a bit more on SO, looking into why, thanks for the good question!
– JordanHendrix
Apr 18 '16 at 17:47