Discussion on: Abstracting Click Events in React

thepeoplesbourgeois profile image

There are a surprising number of uncapitalized language names, among other grammatical errors, in this callout of the lack of i18n considerations. Also, while "ice" in French is indeed "glace" (not capitalized btw), "ice cream" is actually "crème glacée", and "Eis" (which, you're right, German writers would capitalize) refers just to "ice", not "ice cream".

chico1992 profile image

I know that "glace" in French is not capitalized, I wanted to go with the same format from the buttons.
I wanted to point out that the implementation is pretty fragile if the business decides one day that more languages need to be supported
something like the following would be safe ass the text will most likely be used as a i18n key depending on the library that is used

handleClick(itemName) {
        return ()=>{
            console.log("I'm sorry. We don't have that menu item.")
    return this.props[`order${itemName}`];
<button onClick={this.handleClick(this.props.text)}>
    {this.props.text} // this.props.text = "Pizza", "Cheeseburger" or "Ice Cream"