I'm currently trying to use the React style attribute to style React components dynamically. The first styling condition using the attribute is working properly, however on the second condition I'm getting this error: "Parsing error: Unexpected token, expected "}"" Here is my code:
<input
className="inputFieldComponent"
id={field.name}
type={field.type}
value={value}
disabled={(parentState.primaryVinRetrieved && field.name === 'makePrimary')
|| (parentState.primaryVinRetrieved && field.name === 'modelPrimary')
|| (parentState.secondaryVinRetrieved && field.name === 'makeSecondary')
|| (parentState.secondaryVinRetrieved && field.name === 'modelSecondary')}
placeholder={field.placeholder}
onChange={handleInputChange}
style={
field.currency && {
paddingLeft: '10px',
}
field.name === 'makePrimary' && {
color: 'grey',
}
}
/>
Basically I'm trying to chain additional conditionals into the style attribute. Not sure if this is the proper syntax for this. If there is a better way to accomplish this pls advise. Thanks.