You are viewing a single comment's thread. Return to all comments →
when the test fails it because the problem requirements were not completed in my case, So read the problem again.Thank you This is my code
import React, { useState } from "react";
function Slides({ slides }) { const [count, setCount] = useState(0);
const next = () => setCount((prev) => prev + 1); const prev = () => setCount((prev) => prev - 1); const restart = () => setCount(0);
return ( {count === 0 ? ( Restart ) : ( Restart )}
{count === 0 ? ( <button disabled data-testid="button-prev" className="small"> Prev </button> ) : ( <button onClick={prev} data-testid="button-prev" className="small"> Prev </button> )} {count === slides.length - 1 ? ( <button disabled data-testid="button-next" className="small"> Next </button> ) : ( <button onClick={next} data-testid="button-next" className="small"> Next </button> )} </div> <div id="slide" className="card text-center"> <h1 data-testid="title">{slides[count].title}</h1> <p data-testid="text">{slides[count].text}</p> </div> </div>
); }
export default Slides;
Seems like cookies are disabled on this browser, please enable them to open this website
Slideshow
You are viewing a single comment's thread. Return to all comments →
when the test fails it because the problem requirements were not completed in my case, So read the problem again.Thank you This is my code
import React, { useState } from "react";
function Slides({ slides }) { const [count, setCount] = useState(0);
const next = () => setCount((prev) => prev + 1); const prev = () => setCount((prev) => prev - 1); const restart = () => setCount(0);
return ( {count === 0 ? ( Restart ) : ( Restart )}
); }
export default Slides;