1

click here for error image i am new to react and i am just trying to displaying registration form in react and it shows type error while ruuning app on browser and i dont know how to fix it .

my App.js

import React from 'react'
import logo from './logo.svg'
import './App.css'
import Register from './components/Register'

function App () {
  return (
    <div className='App'>
      <Register />
    </div>
  )
}

export default App

and component.js

import React, { Component } from 'react'

class Register extends Component {
  
  regsister () {
    alert('register')
  }

  render () {
    return (
      <div>

        <div>
          <input type='text' /><br /><br />
          <input type='text' /><br /><br />
          <button onclick={() => this.register()}>Register</button>
        </div>

      </div>

    )
  }
}

export default Component

i would really appreciate some answers Thanks for help

1
  • Where are you attaching your app to the DOM with ReactDOM.render()? Commented Jun 8, 2020 at 15:13

1 Answer 1

2

You are doing export default Component.

Export your register component properly. Not the React library Component

export default Register
Sign up to request clarification or add additional context in comments.

1 Comment

yes issue resolved thanks for the help its working now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.