Javascript ReactJs Type error

javascript, reactjs

Solution

You have to export the OTHERPAGE from it's file:

file OTHERPAGE.react.js:

var OTHERPAGE = React.createClass({...});
module.exports = OTHERPAGE;

use the OTHERPAGE component:

var OTHERPAGE = require('./components/OTHERPAGE.react');
var React = require('react');

var parentId = ...;
React.render(<OTHERPAGE id={parentId} />, document.getElementById('main'));

Problem

I am trying to render "OTHERPAGE" when a user clicks the back button ... snippet: ``` onClickBack:function(e){ var parentId = getParentIdById(this.props.id); React.render(<OTHERPAGE id={parentId} />, document.getElementById('main')); }, ``` the function triggers as i expect it. getParentIdById returns the UUID as a string, just how I need it. calling React.render throws an exception: message:"element.type is not a constructor" I dont get it... I required React on top of the page: ``` var React = require('react'); ``` does anyone know what the problem could be here? Thanks for helping EDIT: I also get this warning: "Warning: Only functions or strings can be mounted as React components." Doesn't really help me though...

Original source