0

I run some functions in my app.jsx file and all the functions are run twice while they should only run once.

import React, {useState} from 'react';


function App() {

    function printer(e){
        console.log(e);
    }

    ["hello", "hi"].forEach(printer);

  return (
    <div>
        Hello
    </div>
  );
}

export default App;

result console state:

App.jsx:34 "hello"
App.jsx:34 "hi"
VM679:236 "hello"
VM679:236 "hi"

how can I stop this VM679 from doing this?

Bot Ellis
  • 108
  • 6

1 Answers1

1

I fixed it somehow. The solution was to remove the <React.StrictMode> tags from the index.js file. I dont know why it worked or how it worked but all I know is that it worked.

Bot Ellis
  • 108
  • 6