I have a file variables.js in top src directory, it declares a global variable.
declare var the_top;
In a component I want to access this variable but it claims it's not declared?
import React, {useEffect, useState} from "react";
import {the_top} from "../variables";
const TopElement = (props) => {
const [topElement, setTopElement] = useState();
the_top = "test";
Gives
ReferenceError: assignment to undeclared variable the_top