Page 1 of 1
Is it possible to use some SPA framework such as react?
Posted: 20 September 2022, 19:42
by YEEDA
Is it possible to use some SPA framework such as react?
I already finished a game by using pure js to manipulate the DOM directly.
I am planning to learn a single-page application framework (react).
And I wonder is it possible to use those framework to render the game on bga?
If it is possible, what is the minimal example looks like?
Re: Is it possible to use some SPA framework such as react?
Posted: 20 September 2022, 22:42
by Tisaac
YEEDA wrote: ↑20 September 2022, 19:42
Is it possible to use some SPA framework such as react?
I already finished a game by using pure js to manipulate the DOM directly.
I am planning to learn a single-page application framework (react).
And I wonder is it possible to use those framework to render the game on bga?
If it is possible, what is the minimal example looks like?
Short answer : no.
Long answer : at least two devs (including myself) experimented VueJs which is the easiest one to integrate into this kind of website and we wouldnt recommend doing that.
Re: Is it possible to use some SPA framework such as react?
Posted: 21 September 2022, 16:11
by YEEDA
Tisaac wrote: ↑20 September 2022, 22:42
YEEDA wrote: ↑20 September 2022, 19:42
Is it possible to use some SPA framework such as react?
I already finished a game by using pure js to manipulate the DOM directly.
I am planning to learn a single-page application framework (react).
And I wonder is it possible to use those framework to render the game on bga?
If it is possible, what is the minimal example looks like?
Short answer : no.
Long answer : at least two devs (including myself) experimented VueJs which is the easiest one to integrate into this kind of website and we wouldnt recommend doing that.
So Sad

Re: Is it possible to use some SPA framework such as react?
Posted: 27 September 2022, 01:45
by Victoria_La
I would say it is possible, but not practical.
I managed to get working template using typescript classes, which took me days of hitting head on the wall dealing with dojo.
https://github.com/elaskavaia/bga-dojoless
Its not far fetch to add more processors/webpack to get core react, you have hack it to deal with ajax and comet notification some-how,
but not sure it will make wrtiting game easier even if you get it going...
Re: Is it possible to use some SPA framework such as react?
Posted: 27 September 2022, 08:23
by Een
Also please remember that the most likely reason for a game to be broken by a framework update then abandoned is to add in some specific "creative" code layer or external dependencies that may be hard to maintain.
There is a lot of freedom in the way you can program your game module, but it also means that you can back yourself into a corner. It has happened before.
Re: Is it possible to use some SPA framework such as react?
Posted: 11 October 2022, 14:31
by Tof63
I'm a bit late to answer maybe, but the game I developed uses React for some parts.
https://studio.boardgamearena.com/studi ... reflection
The game board is composed in large part of a grid displaying mirrors and a laser, this part is developed in React. Everything else is developed in a "classic" way following the bga tutorials, and the interactions between the two are minimal.
The complete code of the project can be seen here :
https://github.com/cdelaforge/reflection
I'm not really proud of the php part, I really don't like this language :p
And some things in javascript are certainly optimizable too, but the React part is pretty clean I think
The choice I made was probably debatable, and certainly not suitable for the vast majority of games on the site, but I'm convinced I saved a lot of time by doing this for the particular case of this game: it simplifies the code a lot.
Re: Is it possible to use some SPA framework such as react?
Posted: 01 February 2023, 21:16
by YEEDA
Tof63 wrote: ↑11 October 2022, 14:31
I'm a bit late to answer maybe, but the game I developed uses React for some parts.
https://studio.boardgamearena.com/studi ... reflection
The game board is composed in large part of a grid displaying mirrors and a laser, this part is developed in React. Everything else is developed in a "classic" way following the bga tutorials, and the interactions between the two are minimal.
The complete code of the project can be seen here :
https://github.com/cdelaforge/reflection
I'm not really proud of the php part, I really don't like this language :p
And some things in javascript are certainly optimizable too, but the React part is pretty clean I think
The choice I made was probably debatable, and certainly not suitable for the vast majority of games on the site, but I'm convinced I saved a lot of time by doing this for the particular case of this game: it simplifies the code a lot.
Not late!
Thanks for your reply!
Now I know how to combine npm files to the bga framework.
By the way, the official react tutorial not work for bga even if I upload the source code to the server.
https://beta.reactjs.org/learn/add-react-to-a-website