javascript – Remix.js with react.js application with “TypeError: (0 , import_voteCounter.updateVotes) is not a function”
I have an imported async function from another file that only returns the string literal “test string” and does not do anything else. Here is the code for that:
export const testString = async () => {
return 'This is a test string'
}
In my main react.js file I have the following code:
import { testString } from '~/utils/voteCounter.server';
const [testData, setTestData] = useState('');
useEffect(() => {
const fetchData = async () => {
return await testString();
}
fetchData().then(res => setTestData(res)).catch(console.error)
}, [])
I tried solutions for this on:
How to call an async function inside a UseEffect() in React?
But I still get the following error:
“TypeError: (0 , import_voteCounter.testString) is not a function”
What should I change with my code?
Read more here: Source link
