Following is the code that I am using. I am getting an error like Uncaught TypeError: Cannot read property 'dispatch' of undefined. I also want to dispatch an action.
import { connect } from 'react-redux'
let SearchBar = ({ dispatch }) => {
    let input
    return (
       <div>
           <form>
              <input type="text" placeholder="Search"  />
              <p>
                 <input type="checkbox" />
                 {' '}
                 Free
              </p>                
           </form>
       </div>
   )
}
SearchBar = connect()(SearchBar)
export default SearchBar()
                A couple of things I notice immediately with your code example:
First of all the connect function requires some parameters in the first parenthesis, even if that parameter is a null, also I don't think you need the parentheses on the export line. Try replacing those last two lines with something like this:
export default connect(null)(SearchBar);
see if that makes any difference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With