Creating an array in one function and then using it somewhere else

Solution 1:

If the Memory component is not conditionally mounted/unmounted in the parent, like {condition && <Memory}, you can use the useMemo hook to memoize the imported words at the first render.

const ImportedArray = useMemo(() => ImportedWords().shuffledWords, []);

Anyway the WORDS component is a candidate to be a custom hook where you can encapsulate the words logic. it should be named useWords