2
I have a form where there is a responsible pattern (Novoresponsavel), but if there are some other have to be added a new responsible at each click of the 'add another' button, today I can only add a single time, I would like to know if anyone could add a same Component several times.
New Responsavel is a Component - which has 4 inputs inside it, I just want to repeat the Component.
import {NovoResponsavel} from 'components';
class NovoAtendimento extends React.Component {
handleClick() {
this.setState({
clicked: true
});
}
render(){
return (
<NovoResponsavel/>
{this.state.clicked ? <NovoResponsavel /> : null}
<ItemGrid xs={12} sm={12} md={12}>
<a onClick={this.handleClick} className="addnew">
adicionar outro responsável
</a>
</ItemGrid>
);
}
I already answered a similar question these days... Possible duplicate of How to add HTML with onClick event in React
– NoobSaibot