-2

Trying to avoid extends of Component as the component merely render data, it can be standalone.

const CountDown = () => {
    render(){
        return(
            <p>Countdown.jsx</p>
        )
    }
}

module.exports = Countdown

But what's wrong? I got unexpected token at render(){ ... }

Chris
  • 57,622
  • 19
  • 111
  • 137
Zea Lith
  • 421
  • 1
  • 7
  • 15

1 Answers1

7

Stateless functional components don't have the render() method... in fact they don't have any methods because they are a method themselves.

Try instead:

const CountDown = () => {
  return(
    <p>Countdown.jsx</p>
  )
}

module.exports = Countdown

or even:

const CountDown = () => <p>Countdown.jsx</p>
module.exports = Countdown

As a side-note, you might find this post interesting. It's an in-depth explanation of stateless functional components.

Graham
  • 7,431
  • 18
  • 59
  • 84
Chris
  • 57,622
  • 19
  • 111
  • 137