Michael Roberts Michael Roberts - 1 month ago 10
React JSX Question

Replacing a React.createClass with extends React.Component

Facebook has suggested the future removal of React.createClass completely in favour of ES6 classes. I'm now beginning to go through my react.js classes and replace them with the now accepted

class MyClass extends React.Component
syntax. However, I don't think I'm quite there yet on some things. I have coded the following API mount and gulp doesn't seem to like this particular module when loading:
Cannot find module '.components/ticker-trader' from '/.../src'

My particular class is outlined as:

import React, { Component, PropTypes } from 'react';

class TickerTrader extends React.Component {
constructor(props) {
this.state = {


componentDidMount() {
$.get("api_url", function(data) {

render() {
return (

export default TickerTrader;

Could anyone outline where exactly this has gone wrong...I'm sure it is something simplisitic. I have attempted to fix this by using the documentation but I don't seem to be getting anywhere...


Check your file paths.

Cannot find module '.components/ticker-trader' from '/.../src'

That looks wrong.

Instead of .components/ticker-trader it more than likely should be looking for ./components/ticker-trader.