I am creating a reusable component and one of its features that I want to add is that the background color can be defined with a property.
At this time, my component looks like this:
import React, {Component} from 'react'
import { Row, Col } from 'reactstrap'
class Objetivo extends Component {
render() {
return (
<div className="objetivos-portada">
<Col className={'bg-dark text-light p-3'}>
<h4 className="text-white">{this.props.title}</h4>
</Col>
</div>
)
}
}
But the className bg-dark
is fixed.
I want to call the component that way:
<Objetivo clase={'dark'} title={'Cobertura'} />
<Objetivo clase={'secondary'} title={'Aprobación'} />
And let the class change to bg-dark
or bg-secondary
or any color passed to it as a value in property clase
.