How i can use react component functions in browser [closed]

I have a question.

import React, { useState, useEffect } from "react";

const Speedometer = () => {
  const [show, setShow] = useState(false);

  function test() {
    console.log("123");
  }

  test();


  return (
    <React.Fragment>
      {123}
    </React.Fragment>
  );

};
export default Speedometer;

I have that component, how i can use in browser for example Speedometer.test(), because i want some functions to be executed external, not internal.
And if i write that in browser, it shows me

enter image description here

Please someone help me
BTW: I don’t want to be with window[“test”] = function(), because it will be global function
I want this, because i will not use functions inside application, i will use it external, with console.