How to properly maintain a tree structure parallel to the React component tree

I’m creating a framework agnostic library for 5-way navigation (navigating via direction keys). I want to have bindings for React and other JS frameworks and I started with React since I expect it to be the most difficult one.

The core of the library is a mutable tree. If a React component wants to participate in the navigation it can use a useNavigationNode(options) hook that should create and register the node with the tree on mount and remove it when the component unmounts.

I ran into problems trying to make it work via useEffect since children effects run before parent ones and I need the parent to exist in the tree before creating the child. I ended up creating the node in render and saving it in a ref if it doesn’t already exist and cleaning it up in an effect.

export function useNavigationNode(options: NavigationItemOptions): NodeId {
  const { tree, parentNode } = useNavigationContext();

  const parent = options.parent ?? parentNode;

  // create node in tree on mount
  // its in render so parent nodes get created before children
  // (react runs children effects first)
  const nodeRef = useRef<NavigationItem | null>(null);

  // recreate the node if parent changes
  if (nodeRef.current !== null && nodeRef.current.parent != parent) {
    removeNode(tree, nodeRef.current.id);
    nodeRef.current = null;
  }

  if (nodeRef.current === null) {
    nodeRef.current = createNode(tree, options.id, {
      parent,
      // ...
    });
  } else {
    // update node when options change
  }

  // nodeIds contain parent id so if parent changes the node also gets recreated
  // and the previous  one gets cleaned up
  const nodeId = nodeRef.current.id;

  // cleanup node from tree on unmount
  useEffect(() => {
    return () => {
      removeNode(tree, nodeId);
    };
  }, [tree, nodeId]);
}

I had to handle StrictMode double render/effect so I keep track of how many times the node was inserted/deleted and remove it only when the count reaches 0.

export function createNode(
  tree: NavigationTree,
  localId: NodeId,
  options: NodeOptions,
): NavigationNode {
  const globalId = createGlobalId(options.parent, localId);

  const existingNode = tree.nodes.get(globalId);
  if (existingNode != null) {
    // handle React StrictMode
    existingNode.count += 1;
    const count = existingNode.count;
    if (count > 2)
      console.warn(
        `creating duplicate node: ${globalId}, duplicates: ${count}`,
      );

    return existingNode;
  }

  // create and return new node
}

export function removeNode(tree: NavigationTree, globalId: NodeId) {
  if (globalId === tree.root) {
    throw new Error("cannot remove root node");
  }

  const node = tree.nodes.get(globalId);
  if (node == null) {
    return;
  }

  node.count -= 1;
  if (node.count > 0) {
    return;
  }

  // actually remove the node
}

This seems to work but it feels kinda hacky, it already breaks HMR and I’m not confident it doesn’t violate any React rules.

Are there any problems/bugs I’m about to run into? Does anyone have experience with maintaining a tree structure parallel to the React component one or know of a library that does that correctly?

How to write the right Startup.cs for my Web Application

I’m relatively new to building web applications and could use some assistance. I’ve developed a C# backend using the ASP.NET Web API framework in Visual Studio, along with a simple frontend using JavaScript and HTML.

Currently, my backend works fine using Swagger, but I’m struggling to connect the frontend to the backend and utilize it instead of Swagger. I’ve tried configuring my Startup.cs with the help of online resources and ChatGPT, but it’s not working as expected.

JavaScript File:

let firstName = document.getElementById("firstNameInput");
let lastName = document.getElementById("lastNameInput");
let button = document.getElementById("button");
let output = document.getElementById("output");

button.onclick = function () {
    let user = {
        Vorname: firstName.value,
        Nachname: lastName.value
    };

    fetch("https://localhost:7130/User/GenerateUser", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(user)
    })
        .then(response => console.log(response))
        .catch(error => console.log(error));
};

Backend Controller:

using Microsoft.AspNetCore.Mvc;
using TestBackendFrontend.Model;
using TestBackendFrontend.Service;

namespace TestBackendFrontend.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class UserController : ControllerBase
    {
        private readonly UserService _userService;

        public UserController(UserService userService)
        {
            this._userService = userService;
        }

        [HttpPost("GenerateUser")]
        public IActionResult GenerateFullUser([FromBody]UserModel user)
        {
            _userService.CreateUserName(user);
            return Ok();
        }
    }
}

Startup.cs:

using TestBackendFrontend.Service;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllers();

builder.Services.AddSingleton<UserService>();

builder.Services.AddCors(options => 
{
    options.AddDefaultPolicy(builder => builder
        .AllowAnyOrigin()
        .AllowAnyMethod()
        .AllowAnyHeader());
});

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();
app.UseCors();
app.UseAuthorization();
app.MapControllers();
app.Run();

Thanks in advance for your help!

Why const sheet = excel.workbook.worksheets.getActiveWorksheet(); return null in JADE in excel online?

I’m new to JADE. Additionally, although I have learned JavaScript before, I have not used it for a while, until I want to do some task in Excel. The reason that I want to do some task automatically by JADE in Excel instead of other tools or programming languages (such as VBA), because in online version, I have not found the such thing.

Why does the statement

const sheet = excel.workbook.worksheets.getActiveWorksheet(); 

return null in JADE in excel online?

Code 1.1

async function write_timestamp(excel){
    const sheet = excel.workbook.worksheets.getActiveWorksheet();
    var range='';
    range = sheet.getRange("A1");
  Jade.print("Hello World!!!");
  //Jade.print(JSON.stringify(sheet));  
  
  Jade.print("Get type of Sheet class!!!"); 
  Jade.print(typeof(sheet));
  Jade.print("Get Sheet!!!"); 
  Jade.print(sheet);
  
  Jade.print("Get type of Range class!!!"); 
}

Output:
Output of Code 1.1


What I tried:

Look at these manuals.
Microsoft Javascript Excel API/Excel.Worksheet class

The developers blog

how to hide query string url in Jquery.php?

Hello im new learn about javascript and php
how to hide my url query string from jquery ? cause when i edit data via url and click submit, the url will replaced to my sql

this code

 <?php
    $qry_hadiah = mysqli_query($koneksi, "SELECT * FROM hadiah WHERE status_hadiah = 'Aktif'");
    $no = 1;
    while (mysqli_fetch_array($qry_hadiah)) {
    ?>
    theWheel.segments[<?php echo $no++; ?>].textFillStyle = $text_hadiah;
    <?php } ?>
    theWheel.draw();
    <?php

    $kode_vcr = isset($_GET['kode_voucher'])?$_GET['kode_voucher']:"KOSONG";

    echo '
    function alertPrize(indicatedSegment)
    {
    // Do basic alert of the segment text. You would probably want to do something more interesting with this information.
    alert("Anda menang hadiah : " + indicatedSegment.text);
    window.location.replace("klaim_hadiah.php?voucher_dipakai='.$kode_vcr.'&hadiah_didapat="+indicatedSegment.text);
    }
    ';
    ?>
    </script>

when i try to make .text encrypt the lucky spin wont play,
id_hadiah is the problem, user can edit reward and in this code the id_hadiah is at indicatedSegment.txt

sorry for my bad eng.

lucky spin reward, and hope can solve it

Enter on text field not working in webpages

I am trying to automate a process on webpages. The element is

<input aria-expanded="false" aria-owns="search-dropdown-results" data-accessibility-id="header-search-input-field" data-anchor-id="HeaderSearchInputField" data-lpignore="true" type="text" autocomplete="off" placeholder="Search stores, dishes, products" inputmode="search" id="FieldWrapper-0" aria-describedby="search-dropdown-results" class="Input__InputContent-sc-1o75rg4-3 idveBz" value="">

First, I entered a text in the field and then I want to press Enter. But the Enter part is not working. Please help.

var inputElement = document.getElementById('FieldWrapper-0'); inputElement.value = "TEXT"; inputElement.dispatchEvent(new Event('input', { bubbles: true })); inputElement.dispatchEvent(new KeyboardEvent('keydown', { 'key': 'Enter' }));

I can’t figure out what’s going on. I add an object to the array, it is added, but the old data copies the values from the new object. Problem

I can’t figure out what’s going on. I add an object to the array, it is added, but the old data copies the values from the new object. This is the first time I’ve encountered this.

Here is the code

      var next
      if(cart === null){
        next = 0
      }else {
        next = cart.length
      }
      switch(type){
        case 'horizontal':
          config['0']['type'] = type
          config['0']['id'] = next
          config['0'].idImg = selectSvg
          if(cart === null || cart === undefined || cart.length < 1){
            const news = []
            news.push(config)
            setCountCart(news.length)
            localStorage.setItem('cart-tagstyle', JSON.stringify(news))
            setCart(news)
          }else {
            const news = [...cart]
            console.log(news);
            news.push(config)
            console.log(news);
            setCountCart(news.length)
            localStorage.setItem('cart-tagstyle', JSON.stringify(news))
            setCart(news)
          }
          break;

enter image description here
enter image description here
enter image description here
enter image description here

I tried it without push, according to the following index, the same thing. I searched the Internet, it didn’t help. I’ve been suffering for the second day

Why won’t my Javascript summarized code for changing my html work?

I have a working code that changes my html and arranges classes and data from highest to lowest, but it is very lengthy and I would like to make it smaller. I recently learned Javascript this week so it might be a simple mistake. Thank you!

This is the working code:

if (className[0] == positionedValues[0]) {
  document.querySelector('.first').innerHTML = P1A
  document.querySelector('.P1A').innerHTML = ""
  document.querySelector('.P1A-rank').innerHTML = '1'
} else if (className[0] == positionedValues[1]) {
  document.querySelector('.second').innerHTML = P1A
  document.querySelector('.P1A').innerHTML = ""
  document.querySelector('.P1A-rank').innerHTML = '2'
} else if (className[0] == positionedValues[2]) {
  document.querySelector('.third').innerHTML = P1A
  document.querySelector('.P1A').innerHTML = ""
  document.querySelector('.P1A-rank').innerHTML = '3'
} else if (className[0] == positionedValues[3]) {
  document.querySelector('.fourth').innerHTML = P1A
  document.querySelector('.P1A').innerHTML = ""
  document.querySelector('.P1A-rank').innerHTML = '4'

I tried making it smaller myself but it did not work:

//Constants for places
let firstP = document.querySelector('.first').innerHTML
let secondP = document.querySelector('.second').innerHTML
let thirdP = document.querySelector('.third').innerHTML
let fourthP = document.querySelector('.fourth').innerHTML

const placeReplacement = [firstP, secondP, thirdP, fourthP]

for (let i = 0; i < placeReplacement.length; i++) {
  if (className[0] == positionedValues[i]) {
    document.querySelector('.P1A-rank').innerHTML = i+1
    placeReplacement[i] = P1A
  }
}

This is the full javascript code:

//Arrays for class amount and name
const className = ['P1A', 'P1B', 'P2A', 'P2B'];
const classAmt = [1, 0.5, 3.7, 12.7];

for (let i = 0; i < className.length; i++) {
  className[i] = classAmt[i];
}


//Displaying amounts
document.querySelector('.P1A-amt').innerHTML = className[0]+' kg';
document.querySelector('.P1B-amt').innerHTML = className[1]+' kg';
document.querySelector('.P2A-amt').innerHTML = className[2]+' kg';
document.querySelector('.P2B-amt').innerHTML = className[3]+' kg';


//Positioning by amount and storing in an arranged array
let first = 0;
let second = 0;
let third = 0;
let fourth = 0;

for (let i = 0; i < className.length; i++) {
  if (className[i] > first) {
    first = className[i]
  }
}

for (let i = 0; i < className.length; i++) {
  if (className[i] < first && className[i] > second) {
    second = className[i]
  }
}

for (let i = 0; i < className.length; i++) {
  if (className[i] < second && className[i] > third) {
    third = className[i]
  }
}

for (let i = 0; i < className.length; i++) {
  if (className[i] < third && className[i] > fourth) {
    fourth = className[i]
  }
}

const positionedValues = [first, second, third, fourth]


//Positioning the classes in the HTML
let P1A = document.querySelector('.P1A').innerHTML
let P1B = document.querySelector('.P1B').innerHTML
let P2A = document.querySelector('.P2A').innerHTML
let P2B = document.querySelector('.P2B').innerHTML



//main problem

//For P1A
if (className[0] == positionedValues[0]) {
  document.querySelector('.first').innerHTML = P1A
  document.querySelector('.P1A').innerHTML = ""
  document.querySelector('.P1A-rank').innerHTML = '1'
} else if (className[0] == positionedValues[1]) {
  document.querySelector('.second').innerHTML = P1A
  document.querySelector('.P1A').innerHTML = ""
  document.querySelector('.P1A-rank').innerHTML = '2'
} else if (className[0] == positionedValues[2]) {
  document.querySelector('.third').innerHTML = P1A
  document.querySelector('.P1A').innerHTML = ""
  document.querySelector('.P1A-rank').innerHTML = '3'
} else if (className[0] == positionedValues[3]) {
  document.querySelector('.fourth').innerHTML = P1A
  document.querySelector('.P1A').innerHTML = ""
  document.querySelector('.P1A-rank').innerHTML = '4'
}

//OR

//Constants for places
let firstP = document.querySelector('.first').innerHTML
let secondP = document.querySelector('.second').innerHTML
let thirdP = document.querySelector('.third').innerHTML
let fourthP = document.querySelector('.fourth').innerHTML

const placeReplacement = [firstP, secondP, thirdP, fourthP]

for (let i = 0; i < placeReplacement.length; i++) {
  if (className[0] == positionedValues[i]) {
    document.querySelector('.P1A-rank').innerHTML = i+1
    placeReplacement[i] = P1A
    document.querySelector('.P1A').innerHTML = ""
  }
}


//The rest of this is just repeated working code for arranging the text. I would like to change this aswell if I can find a way to change the first.

//For P1B
if (className[1] == positionedValues[0]) {
  document.querySelector('.first').innerHTML = P1B
  document.querySelector('.P1B').innerHTML = ""
  document.querySelector('.P1B-rank').innerHTML = '1'
} else if (className[1] == positionedValues[1]) {
  document.querySelector('.second').innerHTML = P1B
  document.querySelector('.P1B').innerHTML = ""
  document.querySelector('.P1B-rank').innerHTML = '2'
} else if (className[1] == positionedValues[2]) {
  document.querySelector('.third').innerHTML = P1B
  document.querySelector('.P1B').innerHTML = ""
  document.querySelector('.P1B-rank').innerHTML = '3'
} else if (className[1] == positionedValues[3]) {
  document.querySelector('.fourth').innerHTML = P1B
  document.querySelector('.P1B').innerHTML = ""
  document.querySelector('.P1B-rank').innerHTML = '4'
}

//For P2A
if (className[2] == positionedValues[0]) {
  document.querySelector('.first').innerHTML = P2A
  document.querySelector('.P2A').innerHTML = ""
  document.querySelector('.P2A-rank').innerHTML = '1'
} else if (className[2] == positionedValues[1]) {
  document.querySelector('.second').innerHTML = P2A
  document.querySelector('.P2A').innerHTML = ""
  document.querySelector('.P2A-rank').innerHTML = '2'
} else if (className[2] == positionedValues[2]) {
  document.querySelector('.third').innerHTML = P2A
  document.querySelector('.P2A').innerHTML = ""
  document.querySelector('.P2A-rank').innerHTML = '3'
} else if (className[2] == positionedValues[3]) {
  document.querySelector('.fourth').innerHTML = P2A
  document.querySelector('.P2A').innerHTML = ""
  document.querySelector('.P2A-rank').innerHTML = '4'
}

//For P2B
if (className[3] == positionedValues[0]) {
  document.querySelector('.first').innerHTML = P2B
  document.querySelector('.P2B').innerHTML = ""
  document.querySelector('.P2B-rank').innerHTML = '1'
} else if (className[3] == positionedValues[1]) {
  document.querySelector('.second').innerHTML = P2B
  document.querySelector('.P2B').innerHTML = ""
  document.querySelector('.P2B-rank').innerHTML = '2'
} else if (className[3] == positionedValues[2]) {
  document.querySelector('.third').innerHTML = P2B
  document.querySelector('.P2B').innerHTML = ""
  document.querySelector('.P2B-rank').innerHTML = '3'
} else if (className[3] == positionedValues[3]) {
  document.querySelector('.fourth').innerHTML = P2B
  document.querySelector('.P2B').innerHTML = ""
  document.querySelector('.P2B-rank').innerHTML = '4'
}

Error when trying to bootstrap Angular component ‘A platform with a different configuration has been created’

I want to have a circular progress bar, so I have made a component:

import { Component } from '@angular/core';

    @Component({
      selector: 'app-side-navbar-card',
      standalone: true,
      imports: [],
      templateUrl: './side-navbar-card.component.html',
      styleUrl: './side-navbar-card.component.css',
    })
    export class SideNavbarCardComponent {}

I found a working StackBlizt demo:

https://stackblitz.com/edit/stackblitz-starters-h87v6z?file=src%2Fmain.ts

So I changed:

 selector: from `'my-app'` to `'app-side-navbar-card',`

`export class App` to `export class SideNavbarCardComponent` 

    bootstrapApplication(App, {
      providers: [..

to

    bootstrapApplication(SideNavbarCardComponent, {
      providers: [..

and got an error:

"A platform with a different configuration has been created. Please destroy it first."

What am I doing wrong, and how might I fix it?

How to refresh a component after uploading file successfully

I’m encountering an issue where I need to refresh a parent component (Component A) in React after successfully uploading a file in a child component (Component B). Here’s the breakdown of my setup:

Scenario:

Component A is the parent component, and Component B is the child component.
Component B contains the file upload section along with the upload button.
Upon successful file upload, I aim to clear the values from five dropdown fields in Component A.
Current Approach:

I’ve attempted to clear the state values in Component A using a function (clearDataForm), which increments a key state to trigger a refresh.
Problem:

Although I can clear the state values successfully, the dropdown fields don’t refresh automatically because their values are populated from an API. Therefore, I need to refresh the page to repopulate these dropdown values.

// Parent Component - A
const [key, setKey] = useState(0);

const clearDataForm = () => {
  setKey(prevKey => prevKey + 1);
}

<Form>
  <FormData.Group>
    {/* Field One */}
  </FormData.Group>
  {/* Other fields */}

  {/* FileUpload from Component B */}
  <FileUpload uploadedData={uplodDetails} clearDataForm={() => clearDataForm()}/>
</Form>

// Component - B
const handleFileUpload = async (uploadedFile) => {
  const formData = new FormData();
  formData.append("file", uploadedFile);

  try {
    const res = await API.uploadFiled(Add_Uploaded_File_Fields, id, formData);
    if (response?.status === 200) {
      clearDataForm();
      toast.success("Uploaded");
    }
  } catch (error) {
    // Handle error
  }
}

Objective:

I’m seeking a solution to refresh Component A automatically after a successful file upload in Component B, ensuring that the dropdown fields reflect the updated state without requiring a manual page refresh.
Any assistance or guidance on achieving this would be greatly appreciated. Thank you!

Shorter URL when redirecting with dynamic url

This code checks if a Discord ID is valid by querying the Lanyard API. If valid, redirects to a profile page; if not, it redirects to an error page. The issue is the URL is too long and I want it to be shorter for example this is what I have “https://sye.lol/profile.html?id=208168562286788610”
and this is what I want “https://sye.lol/208168562286788610”.


const submitButton = document.getElementById('submit-button');
const discordInput = document.getElementById('discord-input');


discordInput.addEventListener('input', () => {
    if (discordInput.value.trim() !== '') {
        border.style.borderColor = 'rgba(209, 213, 219, 0.4)';
        submitButton.style.opacity = '1'; 
    } else {
        border.style.borderColor = 'rgba(209, 213, 219, 0.1)';
        submitButton.style.opacity = '0.6'; 
    }
});

submitButton.addEventListener('click', async function() {
    const discordId = discordInput.value.trim();
    
    if (discordId !== '') {
        const servercheck = await fetch(`https://api.lanyard.rest/v1/users/${discordId}`)
        const requestdata = await servercheck.json()

        if (requestdata.success === false) {
            
            body.classList.add('animate-fade-out');

            
            setTimeout(() => {
                window.location.href = 'error.html'; e
            }, 1000); 
            return;
        }

        
        body.classList.add('animate-fade-out');

        
        setTimeout(() => {
            window.location.href = `profile.html?id=${discordId}`;
        }, 1000); 
    }
});


I’ve tried using _redirects, changing the Javascript even learning Nextjs nothing helped. I just want the URL to be shorter! Here is this github repo for full source code if I haven’t provided enough. https://github.com/Sye0001/ender-bio

MDX breaks with “use client” in Next app router

I’ve configured MDX with Next.js 14, but upon navigating to the mdx page, it throws the error:

Error: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it.

My mdx-components.tsx is located at the root of the app directory.
(app/mdx-components.tsx)

Here’s my next.config.mjs:

import nextMDX from "@next/mdx";

/** @type {import('next').NextConfig} */

const nextConfig = {
  env: {
    AIRTABLE_API_KEY: process.env.AIRTABLE_API_KEY,
  },
  pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
};

const withMDX = nextMDX({
  options: {
    remarkPlugins: [],
    rehypePlugins: [],
  },
});

export default withMDX(nextConfig);

And here’s mdx-components.tsx:

import type { MDXComponents } from "mdx/types";

export function useMDXComponents(components: MDXComponents): MDXComponents {
  return {
    ...components,
  };
}

The page I’m trying to render is located at app/work/page.mdx

page.mdx simply contains the title in markdown format.

Tried Solutions:

javascript google.map.marker is deprecated we are switch to advancemarkerelement even though we are getting the error

We are using google map marker in our project for couple of years, suddenly last week we are getting the issue in the marker(javascript), saying that it is deprecated. Alternate of marker google announce to use AdvancedMarkerElement, even though it is not working properly. Sometime it working properly sometimes it throws exception it’s so wired could you please help me to solve this problem thanks in advance.

console error

This code we are using in the project

Now we replace the marker as AdvanceMarkerElement
we pass the mapid as well.

Now we change this code in our project It is working some time it is breaking sometime.

Error Resolving ‘sockjs-client’ and ‘stompjs’ in React and Spring Data Rest Project

I am following this React and Spring Data Rest tutorial and am currently at part 4: https://spring.io/guides/tutorials/react-and-spring-data-rest

I have completed the steps for the current step however, when attempting to run the project I am getting errors. Running ./mvnw clean install I get the following errors:

[INFO] ERROR in ./src/main/js/websocket-listener.js
[INFO] Module not found: Error: Can't resolve 'sockjs-client' in '.../src/main/js'
[INFO]  @ ./src/main/js/websocket-listener.js 3:13-37
[INFO]  @ ./src/main/js/app.js
[INFO] 
[INFO] ERROR in ./src/main/js/websocket-listener.js
[INFO] Module not found: Error: Can't resolve 'stompjs' in '.../src/main/js'
[INFO]  @ ./src/main/js/websocket-listener.js 4:0-18
[INFO]  @ ./src/main/js/app.js

The websocket-listener.js file I am using is as follows:

// websocket-listener.js
'use strict';

const SockJS = require('sockjs-client');
require('stompjs');

function register(registrations) {
  const socket = SockJS('/payroll');
  const stompClient = Stomp.over(socket);
  stompClient.connect({}, function(frame) {
    registrations.forEach(function (registration) {
      stompClient.subscribe(registration.route, registration.callback);
    });
  });
}

module.exports.register = register;

I have attempted to add the resolve: { alias: { ‘stompjs’: … } } as suggested however, the stompjs error still appears. The current webpack.config.js file I am using is:

// webpack.config.js
var path = require('path');

module.exports = {
    entry: './src/main/js/app.js',
    // change devtool from 'sourcemap' to 'eval-source-map' for webpack5 compliance
    devtool: 'eval-source-map',
    cache: true,
    mode: 'development',
    resolve: {
      alias: {
        'stompjs': path.resolve(__dirname, 'node_modules/stompjs/lib/stomp.js'),
      },
    },
    output: {
        path: __dirname,
        filename: './src/main/resources/static/built/bundle.js'
    },
    module: {
        rules: [
            {
                test: path.join(__dirname, '.'),
                exclude: /(node_modules)/,
                use: [{
                    loader: 'babel-loader',
                    options: {
                        presets: ["@babel/preset-env", "@babel/preset-react"]
                    }
                }]
            }
        ]
    }
};

In my package.json I have added sockjs-client and stompjs using the following dependencies and dev dependencies:

{
  ...
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "rest": "^2.0.0",
    "sockjs-client": "^1.6.1",
    "stompjs": "^2.3.3"
  },
  ...
  "devDependencies": {
    "@babel/core": "^7.23.9",
    "@babel/preset-env": "^7.23.9",
    "@babel/preset-react": "^7.23.3",
    "babel-loader": "^9.1.3",
    "webpack": "^5.90.3",
    "webpack-cli": "^5.1.4"
  }
}

I am not sure how to proceed with resolving these errors. Guidance on resolving these errors would be greatly appreciated.

any JavaScript-based Instagram Reels/Post Downloader

I’m seeking recommendations for a solution to download Instagram Reels or posts within a JavaScript environment.

Code snippets or libraries that can be integrated into my JavaScript project.

I appreciate any suggestions or guidance that could help me achieve this functionality within my JavaScript project. Thank you in advance for your assistance!

Цикличный carousel slider с повторяющимися элементами [closed]

У меня есть слайдер с 3 картинками, который проигрывается автоматически при клике на контейнер. Проблема заключается в том, что после 3 картинки слайдер перемещается в начало, то есть к 1 картинке. Я хочу, чтобы слайдер бесконечно двигался вправо и картинки шли одна за другой.
Вот код:

<div class="slide">
                                <div class="inner-slider">
                                <div
                                    class="inner-slide"
                                    style="
                                    background-image: url('');
                                    "></div>
                                <div
                                    class="inner-slide"
                                    style="
                                    background-image: url('');
                                    "></div>
                                <div
                                    class="inner-slide"
                                    style="
                                    background-image: url('');
                                    "></div>
                                </div>
                                <h5></h5>
                                <div class="curtain"></div>
                            </div>




const slides = document.querySelectorAll(".slide");

    let currentSlide = 0;
    let timer;


    timer = setInterval(() => changeSlide(slides[0]), 2500);

    for (const slide of slides) {
      slide.addEventListener("click", () => {
        clearActiveClasses();
        slide.classList.add("active");
        const innerSlides = slide.querySelectorAll(".inner-slide");
        innerSlides.forEach((slide) => (slide.style.transform = "translateX(0%)"));
        currentSlide = 0;
        if (timer) clearInterval(timer);
        timer = setInterval(() => changeSlide(slide), 1000);
      });
    }

    function clearActiveClasses() {
      for (const slide of slides) {
      slide.classList.remove("active");
     }
   }


    function changeSlide(slide) {
      const innerSlides = slide.querySelectorAll(".inner-slide");

      currentSlide++;
      if (currentSlide >= innerSlides.length) {
        currentSlide = 0;
      }

      innerSlides.forEach(
          (slide, index) => (slide.style.transform = `translateX(-${100 * currentSlide}%)`)
      );
    }

Я также пробовал ставить счетчик и получалось так, что при innerSlides.forEach((slide, index) => (slide.style.transform = translateX(-${100 * count}%))) слайдер уходил вправо, но картинок не было, то есть была пустота