I have code like this. How can I write it in cleaner, more elegant way using functional programming in JavaScript? I want to get rid of nested ternary expressions. Any ideas?
props => ({
iconColor: props.isPriority ? (props.isCompleted ? variables.color.lightpurple : variables.color.purple ) : variables.color.gray3,
iconName: props.isPriority ? 'star-full' : 'star-empty',
}))
This is rest of that code:
EDIT:
const enhance: React$HOC<*, InitialProps> = compose(
withProps(props => ({
iconColor: props.isPriority ? (props.isCompleted ? variables.color.lightpurple : variables.color.purple) : variables.color.gray3,
iconName: props.isPriority ? 'star-full' : 'star-empty',
}))
)