Data Fetching
Unanswered
~/.BeastieNate5 posted this in #help-forum
I have a simple data fetching program that I want to get data from a API. I called the program ScriptReader.js. I have a client component that I want to use the function in the ScriptReader program to get the data. The thing is I noctied that the ScriptReader function is running on the client. Is there anyway I can get it to execute on the server instead
ScriptReader.js
Client Component
ScriptReader.js
function getScript() {
// Fetch data
}
export default getScript;Client Component
function handleClick() {
const script = getScript();
}