I want to abstract all strings in my application to a centralized file. I could do the following:
strings.js:
export const MY_STRING = "foobar";
component.js:
import React, { Component } from "react";
import { MY_STRING } from "strings";
class MyComponent extends Component {
render() {
return <div>{MY_STRING}</div>
}
}
But this seems like it could become slow at runtime for a large amount of interpolations. Is there a way to add these strings at build time via webpack to avoid interpolation?