title: TypeError when use the React hooks- useReducer
body: <p><a href="https://i.stack.imgur.com/YSbPW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YSbPW.png" alt="enter image description here"></a>I tried to use the react hooks(useReducer). i got error</p>
  
  <blockquote>
    <p>TypeError: Object(...) is not a function</p>
  </blockquote>
  
  <p>Here i am attached my code and attached the error screenshot also.</p>
  
  <pre><code>import React, { useReducer } from 'react';
  
  function appReducer(state, action){
      switch(action.type){
          case 'add':
              return [
                  ...state,
                  {
                      id:Date.now(),
                      text:'',
                      completed:false
                  }
              ]
          break;
          default:
          break;
      }
  }
  
  export default function myCom(){
      const [state, dispatch] = useReducer(appReducer, []);
      return (
          &lt;div className="App"&gt;
              &lt;h5&gt;React ToDo&lt;/h5&gt;
              &lt;button onClick={() =&gt; dispatch({type:'add'})}&gt;New Todo&lt;/button&gt;
              {
                  state.map(item =&gt;(
                      &lt;div key={item.id}&gt;{item.id}&lt;/div&gt;
                  ))
              }
          &lt;/div&gt;
      );
  }]
  </code></pre>
  
  <p>How to fix this error.</p>