It is possible to export a function that is inside a functional component and that can be imported into another? Example code: https://codesandbox.io/s/blissful-sanne-chk5g?file=/src/App.js:0-275
Component One:
import React from 'react'
const componentOne = () => {
function hello(){
console.log("Hello, says the componentOne")
}
return (
<div>
</div>
)
}
export default componentOne
Component Two:
import React from 'react'
import {hello} from "./ComponentOne"
const componentTwo = () => {
return (
<div>
<button
onClick={hello}>
Hello
</button>
</div>
)
}
export default componentTwo
App.js
import ComponentTwo from "./components/ComponentTwo";
import "./styles.css";
export default function App() {
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
<ComponentTwo />
</div>
);
}