How to get props from with react router dom v6

I am trying to pass :id to url when i click a row of my table
trying using navigate("/edit/"+props); and onClick={() => handleClick(data.PacienteId)} but it didnt work then used useParams and created handleProceed to use it as onclick={handleProceed} but it still not working i just get url provided by Apiurl but /undefined

This is what i have in my routes

function App() {
  return (
    <>
      <BrowserRouter>
        <Routes>
          <Route path="/" exact element={<Login  />} />
          <Route path="/dashboard" exact element={<Dashboard  />} />
          <Route path="/new" exact element={<Nuevo  />} />
          <Route path="/edit/:id" exact element={<Editar />} />
        </Routes>
      </BrowserRouter>
    </>
  );
}

This is my dashboard where i want to pass id to url clicking on table

export const Dashboard = (props) => {
  const [paciente, setPaciente] = useState([]);
  const {id}=useParams();
  const navigate = useNavigate();
  useEffect(() => {
    let url = `${Apiurl}pacientes?page=1`;
    axios.get(url).then((response) => {
      setPaciente(response.data);
    });
  }, []);

  const handleClick = (props) => {
    /* navigate("/edit/" + props); */
    navigate(`/edit/${id}`);
  };
  const handleProceed = (e) => {
    /* history.push(`/edit/${id}`); */
    navigate(`/edit/${id}`);
  };
  return (
    <>
      <Header />
      <div className="container">
        <table className="table table-dark table-hover">
          <thead>
            <tr>
              <th scope="col">ID</th>
              <th scope="col">DNI</th>
              <th scope="col">NOMBRE</th>
              <th scope="col">TELEFONO</th>
              <th scope="col">CORREO</th>
            </tr>
          </thead>
          <tbody>
            {paciente.map((data, i) => {
              return (
                <tr key={i} /* onClick={handleProceed} */onClick={() => handleClick(data.PacienteId)}>
                  <td>{data.PacienteId}</td>
                  <td>{data.DNI}</td>
                  <td>{data.Nombre}</td>
                  <td>{data.Telefono}</td>
                  <td>{data.Correo}</td>
                </tr>
              );
            })}
          </tbody>
        </table>
      </div>
    </>
  );
};

How to translate an element while avoiding flicker?

I’m having a list with a total of 5 elements and on hover, on any individual element, I’m trying to translate that element 7% in the x-direction and -15% in the y-direction with a half-second transition. It’s all working well till here.

Here is the code:

.listContainer{
    background-color:rgba(0,151, 19, 0.1);
    width: 70vw;
    margin: 0 auto;
    margin-top: 5vh;
    padding: 4vh;
}

.listItem{
    background-color:rgba(0,151, 19, 0.2);
    display: grid;
    grid-template-columns: 2fr 6fr 1fr;
    margin-top: 4vh;
    justify-content: row;
    transition: transform 0.5s;
}

.listItem:hover{
    transform : translate(7%, -15%);
    background-color: white;
}

.itemRank{
    text-align: center;
    color: rgb(183 225 188);
    /* border: 2px solid blue; */

}

.listHeading{
    text-align: center;
}

.listImg{
    border: 3px solid red;
}
<div class="listContainer">
        <div class="listHeading"><h1>Lorem, ipsum dolor.</h1></div>
        <div id="listItem1" class="listItem">
            <div class="listImg"></div>
            <div class="listText"><h2>this is item 1</h2></div>
            <div class="itemRank"><h2>#1</h2></div>
        </div>
        <div id="listItem2" class="listItem">
            <div class="listImg"></div>
            <div class="listText"><h2>this is heading 2</h2></div>
            <div class="itemRank"><h2>#2</h2></div>
        </div>
        <div id="listItem3" class="listItem">
            <div class="listImg"></div>
            <div class="listText"><h2>this is heading 3</h2></div>
            <div class="itemRank"><h2>#3</h2></div>
        </div>
        <div id="listItem4" class="listItem">
            <div class="listImg"></div>
            <div class="listText"><h2>this is heading 4</h2></div>
            <div class="itemRank"><h2>#4</h2></div>
        </div>
        <div id="listItem5" class="listItem">
            <div class="listImg"></div>
            <div class="listText"><h2>this is heading 5</h2></div>
            <div class="itemRank"><h2>#5</h2></div>
        </div>
    </div>

enter image description here

But here the problem is, Let’s say you hovered between that first 7% of the element in the x-direction as shown in the image, then the element translates 7% in the x direction and leaves the hovered area and that’s why tries to come back to its original position but it again comes in the hovered area and that’s why again translates and leaves the hovered area that’s why again come back and that’s how it goes in a continuous to and forth motion. So, what can I do to solve this…?

I’m trying to get data from its own github repository using jquery $.get() method but it shows a error. Couldn’t find a any solution [duplicate]

$.get("https://github.com/Ishan-Sanjaya/space-tourism-website/blob/main/data.json", data => console.log(data) )

It shows:

Access to XMLHttpRequest at
‘https://github.com/Ishan-Sanjaya/space-tourism-website/blob/main/data.json’
from origin ‘http://127.0.0.1:5501’ has been blocked by CORS policy:
No ‘Access-Control-Allow-Origin’ header is present on the requested
resource.

GET
https://github.com/Ishan-Sanjaya/space-tourism-website/blob/main/data.json
net::ERR_FAILED 200

in console

Can I compare function parameters within my if statement?

Here is the code:

function howdy_doody(person) {
  let person = 'dog'
  if (person == { name: 'dog' }) {
    return 'hello'
  } else {
    return 'goodbye'
  }
}
howdy_doody({ name: 'dog' }); 

I’m expecting the output hello. I’ve tried declaring the person parameter (see code below) but get the identifier person has already been declared syntax error. I’m confused on if I can compare function parameters within an if statement or not.

Thanks

Unexpected token, expected “;” Error while passing object from FetchMovie to MovieList component

This is MovieList.js and I passed a react object as prop to this component from FetchMovie.js which I gave below. I tried but it’s still there . Pls help

MovieList.js

import React from "react";
function MovieList(props) {
  console.log(props.newFilm)
  let imgURL= props.newFilm.images.still.2.medium.film_image
  return (
    <div className="filmm">
      <h1>{props.newFilm.film_name}</h1>
      <img src={imgURL} />   
    </div>
  );
}

export default MovieList

FetchMovie.js
This is the FetchMovie.js file and through this component I passed users object as a prop to MovieList.js and that error occured. Pls help.
I have given the users object below the FetchMOvies.js.

import React, { useState } from "react";
import MovieList from "./MovieList";
import users from "./MovieView";
let s = users.films;
function FetchMovies() {
  return (
    <div>
      {s.map((film) => (
        <MovieList key={film.film_id} newFilm={film} />
      ))}
    </div>
  );
}

export default FetchMovies;

This is the users object:

users={
  films: [
    {
      film_id: 258136,
      imdb_id: 2119543,
      imdb_title_id: "tt2119543",
      film_name: "The House With A Clock In Its Walls",
      other_titles: {
        EN: "The House With A Clock In Its Walls"
      },
      release_dates: [
        {
          release_date: "2018-09-21",
          notes: "GBR"
        }
      ],
      age_rating: [
        {
          rating: "12A ",
          age_rating_image:
            "https://d2z9fe5yu2p0av.cloudfront.net/age_rating_logos/uk/12a.png",
          age_advisory: "moderate threat, scary scenes"
        }
      ],
      film_trailer: "https://dzm1iom8kpoas.cloudfront.net/258136_uk_high.mp4",
      synopsis_long:
        "In the tradition of Amblin classics where fantastical events occur in the most unexpected places, Jack Black and two-time Academy Award® winner Cate Blanchett star in THE HOUSE WITH A CLOCK IN ITS WALLS, from Amblin Entertainment.  The magical adventure tells the spine-tingling tale of 10-year-old Lewis (Owen Vaccaro) who goes to live with his uncle in a creaky old house with a mysterious tick-tocking heart.  But his new town's sleepy façade jolts to life with a secret world of warlocks and witches when Lewis accidentally awakens the dead.",
      images: {
        poster: {
          "1": {
            image_orientation: "portrait",
            region: "US",
            medium: {
              film_image:
                "https://d3ltpb4h29tx4j.cloudfront.net/258136/258136h1.jpg",
              width: 200,
              height: 300
            }
          }
        },
        still: {
          "2": {
            image_orientation: "landscape",
            medium: {
              film_image:
                "https://d3ltpb4h29tx4j.cloudfront.net/258136/258136h2.jpg",
              width: 300,
              height: 199
            }
          }
        }
      }
    }
  ],
  status: {
    count: 1,
    state: "OK",
    method: "filmsComingSoon",
    message: null,
    request_method: "GET",
    version: "ZUPIv200",
    territory: "UK",
    device_datetime_sent: "2018-09-14T09:26:34.793Z",
    device_datetime_used: "2018-09-14 09:26:34"
  }
};

Getting similar songs using Last.fm API

I’m trying to use Last.fm’s API to find similar songs given a song name. Last.fm has a feature that can do this called track.getSimilar, but both “track” and “artist” are required parameters. However, because of the way this works, I can’t figure out a way to either a) get both a song name, and the artist from one search bar input, or b) get the song’s artist using track.search. Here’s the part of my code relating to this:

useEffect(() => {
  fetch(`${API_GET_SIMILAR_URL}&page=${RESULT_PAGE}&artist=${DEFAULT_ARTIST}&track=${DEFAULT_TRACK}`)
    .then(response => response.json())
    .then(jsonResponse => {
      const tracks = jsonResponse.similartracks[Object.keys(jsonResponse.similartracks)[0]];
      dispatch({
        type: "SEARCH_SUCCESS",
        payload: tracks
      });
    });
}, []);

const search = (searchValue) => {
  dispatch({
    type: "SEARCH_REQUEST"
  });
  fetch(`${API_GET_SIMILAR_URL}&page=${RESULT_PAGE}&track=${searchValue}`)
    .then(response => response.json())
    .then(jsonResponse => {
      if (!jsonResponse.error) {
        const tracks = jsonResponse.similartracks[Object.keys(jsonResponse.similartracks)[0]];
        dispatch({
          type: "SEARCH_SUCCESS",
          payload: tracks
        });
      } else {
        dispatch({
          type: "SEARCH_FAILURE",
          error: jsonResponse.error
        });
      }
    });
};

let {
  tracks,
  errorMessage,
  loading
} = state;
console.log(state);

In my search function I’m getting an Uncaught (in promise) TypeError: Cannot convert undefined or null to object error in the Object.keys line because I’m not using the artist parameter when calling the API. I tried using track.search to get the artist but I’m not sure where/how to incorporate it into my code.

I appreciate any help or advice. Thanks.

Telegraf.js referencing Telegram client API and initializing a new Telegram client

Hi so I’m trying to initialize a Telegram client API just like Telegraf API shows and I run into a problem when running it, and I can’t really figure out why it is happening.

const { Telegraf } = require('telegraf')

//Here is where the problem happens
const Telegram = require('telegraf/telegram')

const tBot = new Telegraf('5195445301:AAGg4j0cqq8Ox7yvRr3X_H2zM9ZsQLOnet0')

The thing is that I can create the bot and run functions for the replies for the messages but I want to make a function that calls the function:

telegram.getFileLink(fileId)

This function executes over a function of the type Telegram initialized by this:

const telegram = new Telegram(token, [options])

And it cannot be executed by the Telegraf object which represents the bot. The error I am getting is the following(which happens when using the require on ‘telegraf/telegram’):

**
internal/modules/cjs/loader.js:455
throw e;
^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath ‘./telegram’ is not defined by “exports” in E:JSlaigDocumentsCodingTel2DTel2Dnode_modulestelegrafpackage.json
**

How to use variable which used inside function out of function js reactjs

I get array names flashcards when I mount the app.

flashcards=[
{id:1, check1:false, check2:false, check3:false},
{id:2, check1:true, check2:true, check3:true},
{id:3, check1:true, check2:false, check3:false}
]

I filtered this array if check1,check2,check3 are true.
I filtered this array inside function. But I want to use filtered object outside function.

  let fl;
  console.log('fl outside',fl)  // undefined

  const checkIfAuth = () => {
  if (flashcards.statusCode === 401 || flashcards.statusCode === 403) {
    console.log('This is not authorized')
    setAuth(true)
  } else {
    // console.log('Authorizaed')
    setAuth(false)
    const checkIfFlase = (flashcard) => {
      return flashcard.check1 === false || flashcard.check2 === false || flashcard.check3 === false
     }
    
     fl = flashcards.filter(checkIfFlase)
     console.log('fl inside', fl)   
   // ↑ filtered right objects 
   // [{id:1, check1:false, check2:false, check3:false},{id:3, check1:true, check2:false, check3:false}]
    
  } 
}

How can I update fl outside function?

Any advice is appreciated.

How to get data from a tag with javascript [duplicate]

is there any way to obtain data or the value that is inside a label?
I need to get the value that is inside the tag <label id="domTextElement"></label>

  <label id="domTextElement">Name: </label>
 
  

  <p id="valueInput"></p> 

  <script> 

    var inputValue = document.getElementById("domTextElement").data; 
      document.getElementById("valueInput").innerHTML = inputValue; 
   
    
  </script> 

Somehow?
Thanks

Why is lazy loading not stopping HTML Images from loading?

I am working with a clients website, he wanted his 139 pictures added to his project page and the site takes forever to load, doesn’t load all images, I added lazy load into the IMG tags and it still takes forever. I NEED THESE IMAGES TO LOAD UPON SCROLLING THROUGH THE GALLERY GRID.

<div class="project-item">
<img src="Projects/1.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">

<img src="Projects/2.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">
<img src="Projects/3.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">
<img src="Projects/4.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">
<img src="Projects/5.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">
<img src="Projects/6.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">
<img src="Projects/7.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">
<img src="Projects/8.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">
<img src="Projects/9.jpeg" height="250" width="175" alt="projects" loading="lazy" />

</div>
<div class="project-item">
<img src="Projects/10.jpeg" height="250" width="175" alt="projects" loading="lazy" />

Typescript: How to push elements to Global Variable array and access outside of function [duplicate]

I’m a typescript/javascript beginner, and I’m having trouble understanding how Global Variables work. I’m trying to push elements into a Global Variable inside a function, and then access those contents outside of the function. However, when I try logging the array outside of the function, it returns an empty array. How can I access those contents outside of the function?

I want to do something like this:

        let myArray: string[] = [];

        getReports().then(reports => {
            reports.forEach((report) => {
                myArray.push(report.coolTitle);
            });
            //If I log myArray here, I can see a list of report titles
            cy.log(JSON.stringify(myArray));
        });

//I want to access the new contents of myArray out here, but it returns an empty list
cy.log(JSON.stringify(myArray));