Import functiom from component file.

Create FormFields.jsx file

1. create file: components > utilities > FormFields.jsx

$ touch src/components/utilities/FormFields.jsx

2. Add the following code

export const GenerateForm = (parameter) => {
  // do something
  return parameter;
}

Usage:

Import:

import { GenerateForm } from "/src/components/utitlies/FormFields";

Call Function

const example = GenerateForm (parameter);

There are times when you just need to create a component that only has a function so other components can use by calling it and processing the code with a parameter. This is how you do it.