Wosley Alarico Wosley Alarico - 5 months ago 34
React JSX Question

Displaying list of values using stateless components

I am trying to display a list with the values of my array tasks.

When I inspect the page and go to console I see this:

Uncaught SyntaxError: embedded: Unexpected token (4:30)

I have no idea of what can possibly go wrong but my code looks like the one below:

<script type="text/babel">
var TaskList = React.createClass({
getInitialState: funtion(){
return {
tasks: [
{title: 'Clean dishes', id: 1},
{title: 'Take out the trash', id: 2},
{title: 'Wash the dishes', id: 3}
render: function(){
return <Task title={task.title} />

var Task = function(props){
<li>Task: {props.title}</li>
<TaskList />,

Hope you can help.

Answer Source

You got a typo error:

getInitialState: function (instead of funtion)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download