Hackerrank React Certification Solutions [Hackerrank Certifications Solutions]

Hackerrank React Certification Solutions [Hackerrank Certifications Solutions]

Competitive Panda

3 года назад

23,530 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Madhav Anand
Madhav Anand - 04.08.2023 12:39

import React from 'react';

function Slides({slides}) {
const [activeState, setActiveState] = React.useState(0);
const reset = () => setActiveState(0)
const next = () => setActiveState(n => n + 1)
const prev = () => setActiveState(n => n - 1)

return (
<div>
<div id="navigation" className="text-center">
<button data-testid="button-restart" className="small outlined" onClick={reset} disabled={activeState===0}>Restart</button>
<button data-testid="button-prev" className="small" onClick={prev} disabled={activeState===0}>Prev</button>
<button data-testid="button-next" className="small" onClick={next} disabled={activeState===slides.length-1}>Next</button>
</div>
<div id="slide" className="card text-center">
<h1 data-testid="title">{slides[activeState].title}</h1>
<p data-testid="text">{slides[activeState].text}</p>
</div>
</div>
);

}

export default Slides;

Ответить
HARI
HARI - 16.01.2023 07:08

❤️

Ответить
Habtamu Firew Enyew
Habtamu Firew Enyew - 01.11.2022 14:04

it didn't work out when the index greater than the length of all slides. but good trial loved it

Ответить
Apoorv
Apoorv - 12.08.2022 23:40

in how many attempts you solved it?

Ответить
Vaibhav Kothiyal
Vaibhav Kothiyal - 27.02.2022 07:34

getting this error , can someone help
expect(element).toHaveTextContent()

Expected element to have text content:
title 0

Received:

title 1

43 |

44 | const titleElem = getByTestId(testIds.title);

> 45 | expect(titleElem).toHaveTextContent(slides[0].title);

| ^

46 |

47 | const textElem = getByTestId(testIds.text);

48 | expect(textElem).toHaveTextContent(slides[0].text);

at Object.<anonymous> (src/App.test.js:45:21)

Ответить
Easy Finance Explained
Easy Finance Explained - 26.12.2021 17:40

Thank you

Ответить
Saurabh Chavan
Saurabh Chavan - 15.11.2021 20:46

Great work✨✌️

Ответить
Learn Chinese Mandarin
Learn Chinese Mandarin - 05.09.2021 05:21

I suggest you remove the music background next time recording a tech video.

Ответить
Sameera Thilakarathne
Sameera Thilakarathne - 05.05.2021 12:51

Superb👌👌👌

Ответить
sumudu sujani
sumudu sujani - 01.05.2021 09:58

Great work. Keep it up.👌😍

Ответить
Naveen Marasinghe
Naveen Marasinghe - 30.04.2021 21:53

👍👍

Ответить
Kalana Sankalpa
Kalana Sankalpa - 30.04.2021 21:34

👍

Ответить
Sameera Karunarathne
Sameera Karunarathne - 30.04.2021 19:51

👀

Ответить
Ravindu Kavishka
Ravindu Kavishka - 30.04.2021 19:17

Maru

Ответить
TravelBrothers
TravelBrothers - 30.04.2021 19:12

Supiri <3

Ответить
Neo Perera
Neo Perera - 30.04.2021 19:09

🔥🔥

Ответить
Dimuthu Abeysinghe
Dimuthu Abeysinghe - 30.04.2021 19:04

❤️❤️😍😍

Ответить
Dilakshika Perera
Dilakshika Perera - 30.04.2021 18:29

😍🤩

Ответить
Kaushalya Ilukwaththa
Kaushalya Ilukwaththa - 30.04.2021 18:13

♥️♥️

Ответить