Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140131

Using Constructor(props) without Class Component

$
0
0

I have created a search bar in TypeScript but for now I am unable to type anything into it. All the control component tutorials that I have seen suggest to use constructor(props) or so. If I use it in my code, I get errors.

Is there any way to use it without having a class component?

For instance, I am using a const() for my page. Is there any way I can make the search bar of this functional?

const userSearchPage = () => (
  <div>
    <PermanentDrawerLeft></PermanentDrawerLeft>
    <div className='main-content'>
      <MuiThemeProvider>
        <DropDownMenu >
          <MenuItem style={{ fontSize: "20px" }} primaryText="Search By" />
          <MenuItem value={1} style={{ fontSize: "20px" }} primaryText="First Name" />
          <MenuItem value={1} style={{ fontSize: "20px" }} primaryText="Last Name" />
        </DropDownMenu>
      </MuiThemeProvider>
   <SearchBar
        onChange={() => console.log('onChange')}
        onRequestSearch={() => console.log('onRequestSearch')}
        style={{
          margin: '0 auto',
          maxWidth: 800
        }}
     />
    </div>
  </div>
);

Viewing all articles
Browse latest Browse all 140131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>