0

So currently I'm trying to start a react app, and create my own components.

Inside TimeChooser.js

import React from 'react';

function timeInput(){
    return(
      <div>
      <p>Test</p>
      <input type='time'></input>
      </div>
    )
}

class TimeChooser extends React.Component {
  render(){
    return (
      <div className='TimeChooser'>
        <h2>Choose what time you want to play pool</h2>
        <timeInput/>
      </div>
    );
  }
}

export default TimeChooser;

Inside Index.js

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import TimeChooser from './TimeChooser';
import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(<div>
  <App />
  <TimeChooser />
  </div>, document.getElementById('root'));
registerServiceWorker();

So Currently, when I go to the main page on my app, TimeChooser will render on the page, but the timeInput() will not, I'm pretty new to React and JS in general, sorry if this is a dumb question or I missed something.

UPDATE Nevermind! I'm an idiot and the component needs to be capitalized like TimeInput() and <TimeInput/>

2
  • It looks like you are using .tsx but then timeInput isn't a fully defined component and is actually using .jsx. I may also recommend sticking with one or the other just for code consistency :-) Commented Sep 6, 2017 at 22:10
  • I was about to say I think it's the capitalisation that's the problem. There is learning in mistakes (even public ones) Commented Sep 6, 2017 at 22:17

0

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.