I have a situation , where i have to render some component (e.g. ) in multiple pages of my app , so i have to check if current path matches the paths i provide via CONSTANTS .
if(this.props.location.pathname.match(CONST1) || this.props.location.pathname.match(CONST2)) {
render component ...
}
Yes this works well , but i think there is more elegant solution maybe with Regexp . Any advice ? I have also tried this but it didn't work for my situation
if(this.props.location.pathname.match(CONST1 || CONST2)){
render component ...
}