Js Loop External Variable Declaration In Reactjs