import { useState } from 'react'; import ReactDOM from 'react-dom/client' import React from 'react'; //Zwracanie tablicy zawierajacej publikacje z okreslonego kresu export default function YearOfPublished(){ const publishedYears = Book.filter( element => { if(element.year_of_publish > 2020 || element.year_of_publish < 2024) return element; }); return(

{publishedYears.map( item => { return(

{item.author}

{item.title}

{item.year_of_publish}

) })}

) } const Book = [ { id: 1, title : "7 habits of succesfull people", author : "David Allen", pages : 320, year_of_publish : 2020,}, { id: 2, title : "What the top one knew What you don't", author : "Andy Wallen", pages : 350, year_of_publish : 2021,}, { id: 3, title : "My Wishes, My Problems", author : "Garry Oldman", pages : 390, year_of_publish : 2019,}, { id: 4, title : "Where is really my train", author : "Maggy Grace", pages : 400, year_of_publish : 2017,}, ]; export { Book } ; const element = ReactDOM.createRoot(document.getElementById('root')); element.render();