0
How can I create these Buttons within my <div className="box-statusA">
when arriving in the indices of the status chosen
import React, {useState} from 'react';
import ReactDOM from 'react-dom';
import {useHistory} from 'react-router-dom';
import './style.css'
export default function StatusA(props){
let estados = ['Geração Iniciada', 'Geração Finalizada', 'Registro Inciado', 'Registro Finalizado']
function Button(){
if(estados.length == 4){
const button = (
<button>Conitinuar</button>
)
ReactDOM.render(button, document.getElementById('button'))
}
else if(estados.length == 6){
const buttons = (
<div>
<button>Continuar</button>
<button>Reiniciar</button>
</div>
)
ReactDOM.render(
buttons,
document.getElementsByClassName('buttons')
)
}
}
Button()
return(
<div className="container">
<div className="box-statusA">
<div className="spinner">
</div>
<div id="button">
</div>
</div>
</div>
)
}
You must render within the Return... Com method
{buttons}
in the place that makes sense within the HTML structure– Rafael Tavares
estados == estados[4]
doesn’t make sense... you’re comparing an entire arrya to her own position 4... you can review those names?– Sergio
@Rafaeltavares is that it will only appear after some processes are executed, such as those that have been listed.
– JAVASTO
You don’t use Reactdom to create conditions, and I don’t really understand your problem, I could explain it better?
– novic