Reputation: 561
I'm trying to import a function from an App.js (it checks the string in the URL) to another module, but outside App.js the function returns an [object Object]
. Tell me, please, what could be the reason? I tried different syntax for export, the result is the same.
export function itTest(){
const mobileAp = location.search.indexOf("mobile=true") > -1;
return ( mobileAp
)}
const test = {itTest};
console.log(test)
[object Ojbect]
Upvotes: 0
Views: 490
Reputation: 8632
you're creating an object with a field itTest
that wraps the function
const test = {itTest};
if you want to have an alias change it to
const test = itTest;
or just use itTest
directly
Upvotes: 1