H
H
hateyyyy2016-02-25 16:17:08
JavaScript
hateyyyy, 2016-02-25 16:17:08

Why can't I export the component?

Hello, there is such a problem.
there is an app.jsx file

import React, { Component } from 'react'
import enterForm from './formi.jsx'
import ReactDOM from 'react-dom'

ReactDOM.render(
  <enterForm />,
  document.getElementById('formi')
)

And there is a formi.jsx component
import React, { Component, PropTypes } from 'react'

export default class enterForm extends Component {
  render() {
    return (
      <div>
        <label>Логин</label>
        <input type='text' ref='login' />
        <label>Пароль</label>
        <input type='text' ref='pass' />
        <button onClick={e => this.handleClick(e)}>
          Add
        </button>
      </div>
    )
  }

  handleClick(e) {
    alert('tyty');
  }
}

I launch and there is nothing on the page.
But if you declare the component in app.jsx , then it works fine.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Antropov, 2016-02-25
@hateyyyy

Component name must start with a capital letter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question