lundi 15 février 2021

Wildcard matching in a React if statement?

Is it possible to do a wildcard matching in a React if statement? For example if my url contains either localhost or production, and I want to do the following:

  render() {
if (window.commonUI.hostname like '%local%') {
  return (
    // do something
  )
} else if (window.commonUI.hostname like '%prod%') {
    return (
      // do something else
    )
... and so on

Is this valid/ correct React syntax? I am getting an error when I compile my code and couldnt find any support for wildcards in React

Aucun commentaire:

Enregistrer un commentaire