in my react project,Is there any way to replace template copy at runtime based on the current logged-in user

Now there’s a scene,in our react project,there are many copywriters called “user”,now we want to replace “user” with a user name based on the current logon user,such as: current user name is john,copywriter is “Welcome user to login”,we hope browser presented is “Welcome john to login”。because “user” is too much,so we want to replace it with placeholder

now my my idea is: use some tools, such as webpack plugin to realize,in building stage, we can use string-replace-webpack-plugin, but now we are in runtime stage,how to resolve it?

Leave a Comment