Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class method issue #266

Open
Balajisivakumar92 opened this issue Aug 26, 2018 · 2 comments
Open

Class method issue #266

Balajisivakumar92 opened this issue Aug 26, 2018 · 2 comments

Comments

@Balajisivakumar92
Copy link

Balajisivakumar92 commented Aug 26, 2018

I am getting error message when I am using class method .
error message : TypeError: Super expression must either be null or a function, not undefined

here is my code : search_bar.js

import React from 'react';
class SearchBar extends React.component {
    render() {
        return <input />;
    }
}

export default SearchBar;

here is my code : index.js

import React from 'react';
import ReactDOM from 'react-dom';

import SearchBar from './components/search_bar';

const API_KEY = 'AIzaSyAXOBp2n4bKsYZYorX0HIerLGK6sqwvuwc'; 

// create a new component. This component should produce
// some HTML 

const App = () => {
    return (
    <div>
        <SearchBar />
    </div>
    );
}

// Take this component's generated HTML and put it
// on the page (in the DOM)

ReactDOM.render(<App />, document.querySelector('.container'));

help me to solve this error.

@kelvinkhai
Copy link

In your search_bar.js
class SearchBar extends React.component {

change the component to Component

beware of the big letters.

@vinay72
Copy link

vinay72 commented Sep 15, 2018

In your search_bar.js you should do this
class SearchBar extends React.Component {
render() {
return ;
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants