score:2
the error is not of usereducer but you have wrongly used the export default:
export default function mycom(){
if you want to export named function, then you could do:
// function definition
function mycomp() {}
// then export
export default { mycomp }
then you can use like:
import something from '...'
something.mycomp()
but if there's only one function that you wanted to export then i will do it as:
export const mycomp = () => {}
now, you can import like:
import { mycomp } from '...'
mycomp()
Source: stackoverflow.com
Related Query
- TypeError when use the React hooks- useReducer
- Export actions when we use the UseReducer hook approach for React app
- React useState hooks initial value is null, after few seconds when got value then not updating where is use the value
- How do I use react hooks to tidy up a functional component when it unmounts (using values from state in the tidy up)
- TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app
- React functional stateless component, PureComponent, Component; what are the differences and when should we use what?
- TypeError dispatcher.useState is not a function when using React Hooks
- Accessing the State of a Functional Component with React Hooks when Testing with Enzyme
- What's the alternative to use hooks inside non React component?
- "TypeError: Object(...) is not a function" error when trying to use react hooks (alpha)
- How to use React.FC<props> type when the children can either be a React node or a function
- Does it hurt performance to use the react redux hooks in a list?
- When to use React Hooks
- Receiving error - Hooks can only be called inside of the body of a function component when implementing React Spring basic example
- In React JS, when should you use a store vs directly manipulating the view's state?
- use React Hooks to change the elements class Name and siblings
- In a React Component, what's the difference between foo(){} and bar = () => {} and when should I use which?
- I have read the React Docs on Hooks and I'm confused. When is the useEffect Hook clean up function called?
- How can I use useEffect in React to run some code only when the component first mounts, and some other code whenever an event occurs (repeatedly)?
- Rendered more hooks than during the previous render. when posting form data with React Hooks
- React Hooks state not working properly when the function calling it is called in another function
- When is it necessary to use `rerender` with the React Testing Library?
- Prevent Modal Rerendering when only Modal Content Change: React Hooks useReducer
- how to change background color when I click the button using react hooks
- React hooks - how to force useEffect to run when state changes to the same value?
- Can I use mock data and proxy api data at the same time in my react project when using node express as a proxy server?
- What is proper way to use react hooks when calling javascript functions?
- What to use as key when rendering a list of elements in react if the objects have no property which can be used as an unique identifier?
- React Hooks and React Query (useQuery): invoking the API call/ query only when a button is clicked
- Why do React hooks use a const in the React Docs?
More Query from same tag
- reactjs proper use of functions and hooks - I get errors
- Show component for each dynamic div in react
- Uncaught TypeError: (0 , _react.createClass) is not a function
- Send alerts in GetServerSideProps in whilst redirect?
- Socket.io Server Emit only works after server restart
- how to render a video from contentful in gatsbyjs
- cant receive the token in node using JWT inside httpOnly cookie
- Gatsby & GraphQL - render a download link from a queried file
- How to use variables in dot notation in Google Cloud Firestore
- Horizontal scrolling in mobile view iOS
- TypeError: Object.entries(...).flatMap is not a function
- Filter an Image on upload in react
- How to type inded signature in object
- how to query firestore v9 data in react js
- rename all key's objects JS
- Apply button 'Active' styles on keypress in React
- React router get currently active segment as param
- React Fullstack: not able to fetch item details from Rest API
- Cannot GET /posts
- lazy loaded modules share same dependencies?
- Convert objectID or _id from MongoDB Stitch query to string and map it
- Declaring Const With Curly Braces in JSX
- SCRIPT438: Object doesn't support property or method 'setPrototypeOf'
- replace not working in reactjs
- Load async data before rendering the DOM
- Consume API with basic authentication using Javascript without exposing key pair
- Conditional rendering with routing
- Fetching data from api and passing it to state in React
- React Invisible reCAPTCHA
- Ant Design - Vertical Group of Checkboxes