'Uncaught TypeError: inputArgs[0].match is not a function

I am starting to learn to react with REST Countries API. I have to face the error "Uncaught TypeError: inputArgs[0].match is not a function" in console. also, console data shows duplicate results. you can see the screenshot.

here is my code

import { useEffect, useState } from "react";
import "./App.css";

const gridStyle = {
    display: "grid",
    gridTemplateColumns: "repeat(4, 1fr)",
    gridGap: "20px",
};

function App() {
    return (
        <div className="App">
            <Countries></Countries> 
        </div>
    );
}

function Countries() {
    const [countries, setCountries] = useState([]);
    useEffect(() => {
        fetch("https://restcountries.com/v3.1/all")
            .then((res) => res.json())
            .then((data) => setCountries(data));
    }, []);

    return (
        <div className="all-countries">
            <p>{countries.length}</p>
            <div style={gridStyle} className="country-container">
                {countries.map((country) => (
                    <Country country={country}></Country>
                ))}
            </div>
        </div>
    );
}

function Country({ country }) {
    console.log(country);
    return (
        <div className="country">
            <img src={country.flags.png} alt="" />
            <h1>{country.name.common}</h1>
            <p>{country.name.official}</p>
            <p>{country.region}</p>
            <p>{country.population}</p>
            <button>Details</button>
        </div>
    );
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>


Solution 1:[1]

I got around the error by passing string as first argument.

console.log('', data)

Solution 2:[2]

I think this was broken by a recent commit in the React Dev Tools Chrome Extension: https://github.com/facebook/react/commit/852f10b5cf188f8aa797f9a809f0caeaa95a4231

Hopefully that commit gets reverted soon.

Solution 3:[3]

I had a similar issue, for me the real error was in the stack trace before the one that says "Uncaught Type Error InputArgs[0].match ..."

So clear the console, then run it again to get the stack trace then scroll all the way up to see the error.

HTH

Solution 4:[4]

The whole day I tried to fix this issue and finally realized it happened from the React dev tool So I think it will fix by the React dev tool authorizer.

Solution 5:[5]

i had the same problem, but it worked when i removed the console.log(variable)

Solution 6:[6]

Remove React Dev tool. This is the only solution i've discovered till now and it works.

Solution 7:[7]

if you check a few lines down in Uncaught TypeError message, maybe find a file name you've modified. for me, it was App.jsx. and i found console.log(variable) when i remove this, all clear

Solution 8:[8]

I am face the same problem and solved by following way...

use useEffect to console.log(user) or console.dir(user) the user from useState

useEffect(()=>{
       if (user) {
         console.log(user);
         console.dir(user)
        } 
 },[user])

its working for me, try and let me know through reply this comment

Solution 9:[9]

As @francis mentioned, a simple solution that adds no dependencies with using any hooks is to start by logging a string followed by your variable.

console.log("", variable_name);

Solution 10:[10]

I removed the React.StrictMode tags in index.js and that worked for me. Just comment out

//<React.StrictMode>
    <App />
//</React.StrictMode>