I am building a chat application with a dashboard using react js, I want the client to copy a script link in order for the app to be embedded on his own website as a widget, each client will have a unique javascript file link.
What is the best way to generate those unique javascript files based on id? Or is there a different way for this to be done?
So to summarize, you are building a chat application and you like to make it possible for clients to embed there chat app in there website.
This is something you can not do with React, and you do not need to generate files for it or something like that. This is something you need to enforce on the back-end, and it heavily depends on the implementation of your chat app.
A really basic implementation would be to generate a unique token for each client. The embed url would be something like https://yoursite.com/chat.js?toke=abcde
. The token is send to the back-end with each request to identify the client.