marco
05/16/2018, 5:06 PMcomponentDidMount()
method but as my application grows, thats very shit for scaling to do everything on the client since the bundle grows and grows.
So my question:
What is the best way to encounter this problem? Any suggestion is a good suggestion, I'm still at a stage were I can easily rewrite a bunch of code.
Thank youlawjolla
05/16/2018, 5:18 PMfunction translateCondition(selectedCondition) {
const conditions = {
good: "Good", great: "Totally Awesome" ...
}
return conditions[selectedCondition] || `translation not found`
}
...
const Component = ({ selectedCondition }) => (
<div>{translateCondition(selectedCondition)}</div>
) // "Totally Awesome"
Normally these are ok to be hard coded because they infrequently change and are part of your UI, but you could always store them on the server and make a GraphQL query for the translation object.