title: Exporting functions with reactjs and babel
body: <p>I have a project using reactjs, which is transpiled by babel. I use the es2015 and react transforms in my <code>.babelrc</code>. I am currently refactoring and in my first pass I basically did <code>export class foo</code> for everything I needed. A lot of these classes should really just be functions, so I am trying to rewrite them as such, but I keep getting the same error. My main application file looks somethings like this:</p>
  
  <pre><code>import React, { Component } from 'react';
  
  import {Foo, Bar} from './components/ui.js';
  
  class Application extends Component {
  
    constructor(props){
      super(props);
      this.state = {
        object: null
      }
    }
  
    componentDidMount(){
      // code
    }
  
    componentDidUpdate(){
      // other code
    }
  
    render(){
      return(
        &lt;div&gt;
          &lt;Foo /&gt;
          &lt;Bar /&gt;
        &lt;/div&gt;
      )
    }
  
  }
  
  module.exports = Application
  </code></pre>
  
  <p>And my import from <code>ui.js</code> is like this:</p>
  
  <pre><code>import React, { Component } from 'react';
  
  export class Foo extends Component {
    constructor(props){
      super(props);
    }
  
    render() {
      return (
        // Some JSX
      )      
    }
  }
  
  
  export class Bar extends Component {
    constructor(props){
      super(props);
  
    }
  
    render() {
      return (
        // Some other JSX
      )      
    }
  }
  </code></pre>
  
  <p>When I try and change one of these exported classes to a function, for example:</p>
  
  <pre><code>// Note: I have tried a variety of syntax such as function, const, etc...
  export var Bar {
    render() {
      return (
        // Some other JSX
      )      
    }
  }
  </code></pre>
  
  <p>I get the following error: </p>
  
  <pre><code>SyntaxError: Unexpected token &lt;line where I declare a function&gt;
  </code></pre>
  
  <p>I am not sure what I am doing wrong, and my google searches are only coming up with answers to other problems.</p>