conditional props react

Solutions on MaxInterview for conditional props react by the best coders in the world

showing results for - "conditional props react"
Lisa
12 Jan 2017
1render() {
2  return (
3    <a className="navbar-brand" {... url ? {href: url} : {}}>Logo</a>
4  )
5}
Felipe
20 Jun 2016
1// single prop
2propName={ condition ? something : somethingElse }
3propName={ condition && something }
4// multiple props
5{ ...( condition ? { ...setOfProps } : { ...setOfOtherProps })}
6{ ...( condition && { ...setOfProps })}