i want to render a jsx if condition is true using ternary operator and using react and javascript.
what i am trying to do? when the variable admin is true an count is < 0 i donot want to display the button "add". and should display under conditions below
admin && count > 0 !admin
below is my code,
render = () =>{ return ( <button> add </button> //should render this based on condition ) }
Could someone help me fix this. thanks.
EDIT: below are the conditions to be displayed
count > 0 && is_admin count > 0 && !is_admin count <0 && !is_admin
condition when not to be displayed
count <0 && is_admin
null
if your condition fails. e.g.render() {if (!myCondition) return null; return <button>...</button>}