3

In App.tsx I'm importing CounterComponent.tsx , the import works if CounterComponent is exporting a function but not a React class.

Here is the commit if you want to clone/reproduce: https://github.com/Falieson/react15-meteor1.5/commit/d06ebc80c4b75850338c9a2cf11cf3ec49cafa40

Thank you for your help

App.tsx

import * as React from 'react';
import Counter from './counter/CounterComponent'

const App = (
  <div className='app-container'>
    {Counter}
  </div>
)
export default App

CounterComponent.tsx

import * as React from 'react'

class CounterModule extends React.Component<{}, {}> {
  public render() {
    return (
      <div>
        Counter Module Placeholder
      </div>
    )
  }
}

export default CounterModule

1 Answer 1

3

In React you should use <Element /> when you want to render some element. So change

const App = (
  <div className='app-container'>
    {Counter}
  </div>
)

to

const App = (
  <div className='app-container'>
    <Counter/>
  </div>
)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I'm embarassed how quickly I forgot this fundamental piece of react after only 6-weeks in another frontend

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.