Photon Realtime + React?
Options
Hello! Apologies if this has been answered before but the docs seem pretty sparse and I searched the forum and haven't found an answer.
I'm trying to add Photon to my ReactJS app. Currently I'm doing the following:
(Removed some code of course.) But I'm getting this error:
I'm trying to add Photon to my ReactJS app. Currently I'm doing the following:
import "./Photon/Photon-Javascript_SDK.js"; import React, { createContext, useEffect, useState } from 'react'; const App = () => { useEffect(() => { var client = Photon.LoadBalancing.LoadBalancingClient); }, [])
(Removed some code of course.) But I'm getting this error:
'Photon' is not defined no-undefI've tried about a million ways of including the sdk. Anybody know what I might be doing wrong?
0
Comments
-
Hi,
Photon lib is just a js code, you need to run it somehow, then Photon object will appear in global namespace. Not sure if 'import' executes something. Can you try simple <script src=.../> in html?0