// search-box.jsx
import './search-box.scss';
const SearchBox = (props) => (
<input
className='search'
type='search'
placeholder={props.placeholder}
onChange={props.onSearchChange}
/>
);
export default SearchBox;
// is same as above but worse in terms of code
import './search-box.scss';
export const SearchBox = ({ placeholder, onSearchChange }) => (
<input
className='search'
type='search'
placeholder={placeholder}
onChange={onSearchChange}
/>
);
export default SearchBox;
// App.js
<SearchBox
placeholder='Search...'
onSearchChange={this.onSearchChange}
/>
//
No comments:
Post a Comment