React Draggable property only being applied to final element in array

I am looking to add draggable list items to my DOM via JSX in react.

The expected output into the DOM should look like this:

<li draggable="true" style="border: 1px solid red;">Test Scenario 1</li>
<li draggable="true" style="border: 1px solid red;">Test Scenario 2</li>
<li draggable="true" style="border: 1px solid red;">Test Scenario 3</li>

But the actual output is:

<li style="border: 1px solid red;">Test Scenario 1</li>
<li style="border: 1px solid red;">Test Scenario 1</li>
<li draggable="true" style="border: 1px solid red;">Test Scenario 1</li>

Current code I have tried:

import React from 'react';
import { useDrag } from "react-dnd";

function LibraryItems(props) {

    const [{ isDragging }, dragRef] = useDrag(() => ({
        type: "li",
        collect: (monitor) => ({
            isDragging: monitor.isDragging(),
        }),
    }));

    
    // Declare and populate array of Library Scenarios
    const itemList = []
        
    props.items.map(item => {
        itemList.push(<li style={{border: 'red 1px solid'}} ref={dragRef}>{item.title}</li>);
    })

        
    return (
        <ul>
            {itemList}
        </ul>
    )
}

export default LibraryItems

Get worldposition of an object in React Three Fiber without onClick

currently I am creating a robot model in react. This robot model is in .glb format and I am using React Three fiber to paste every mesh object in to the scene (I got the names of the meshes from blender). Via zustand and my control function I can rotate some joints to move the robot in the direction of desire. My next goal is to “extract” each worldcoordinate of the joints and show them in my overlay close to the control buttons.
I already tried something like that:

<mesh
                    ref={joint_1}
                     onClick={(vectorEvent) => {
                       let vector = new THREE.Vector3();
                       vectorEvent.object.getWorldPosition(vector);
                       console.log(vector);
                     }}
></mesh>

but this only works when I click the joint I want the coordinate from. I want to do this with an onClick event on my control function(complete different function and not part of THREE nor GLTF) when I change some angles. Any Ideas?

Object destructuring in Javascript – trying to make sense

probably a bit of a silly question but I’m only a beginner and there’s something I am trying to understand properly.

When we have code like this:

const { userName } = await getUserProfile({ userId });

What exactly is happening here? Are we destructuring userName out of the getUserProfile object to be able to access that property? And does userId mean that the getUserProfile function has a parameter that is an object that has a property userId?

Sorry, if this is too beginner of a question but would really appreciate it if anyone had the time to explain this to me please.

Is it possible for Block level element inside of an In-line element?

I read that in HTML, a block-level element can’t be used inside of an In-line element. For example, <span>Hi <div>!</div></span> is not possible as <span> is an In-line element and <div> is a Block-level element.
But, I also read that <a></a> is an In-line element and have frequently seen <div> tags being used inside of a <a> tag. How is this possible and what am I missing?

Inherit props from parent functional component in React.js

In a functional component I want to access props inherited from the parent functional component. To get an idea what I mean, I have the following snippet:

function MainApp(props) {
    const { classes } = props;
    const [content, setContent] = useState("");

    return (
        <div className={classes.root}>
            <AppBar position="fixed" className={classes.appBar}>
                <Toolbar className={classes.toolbar}>
                    <Typography variant="title" color="inherit" fontWeight="bold">
                        CashCo
                    </Typography>
                    <ToolbarActions className={classes.toolbarActions} />
                </Toolbar>
            </AppBar>
            <main className={classes.appContent}>
                <PageContent content={content} />
            </main>
        </div>
    );
}

function App(props) {
    return (
        <BrowserRouter>
            <Routes>
                <Route path="/" element={<MainApp />}></Route>
            </Routes>
        </BrowserRouter>
    );
}

I want to pass the props argument in the App() function to the MainApp(), such that I don’t have to access properties like props.props.some_property. How can I do that correctly? Cause passing props like this <MainApp props={props} /> means I have to access the properties like props.props.some_property in MainApp(), that’s not what I want. I want to access the props like props.some_property in MainApp().

Add and remove html element by jquery

How can I add new <tr> after a clicked <tr>. On click of this <tr> and remove now created when click other <tr> (with repeat 1st scenario) by jQuery?

I tried like this, but it does not work:

$("#test_table tr").click(function() {
  $(this).prev().remove();
  $(this).closest('tr').append('<tr><td>2.2</td></tr>');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id="test_table">
  <tr>
    <td>1</td>
  </tr>
  <tr>
    <td>2</td>
  </tr>
  <tr>
    <td>3</td>
  </tr>
</table>

sequelize-auto please i need more explanation

I am new to node js and I generated the models using sequelize-auto
I am encountering this error when I follow the recommendation of this link https://github.com/sequelize/sequelize-auto . if you i need more explanation

please here are my codes

my controller

var jwtutils = require ('../util/jwt');
var db = require ('../routes/bd');
const multer = require ('multer');
var jwt = require ('jsonwebtoken'); 
const base64 = require ('node-base64-image');
const mime = require ('mime');
const base64Img = require ('base64-img');
var initModels = require("../models/init-models");
var models = initModels(sequelize);

exports.get_publication = function (req, res) {
  models.publications
  .findAll ({
    where: {
      $and: [
        {'$users.ID_USER$': '$publications.ID_USER$'},
        {'$publications.ID_QUARTIER$': '$quartiers.ID_QUARTIER$'},
        {'$publications.ID_PRODUIT$': '$produits.ID_PRODUIT$'},
        {'$publications.ID_TYPE_PUB$': '$type_pub.ID_TYPE_PUB$'},
        {'$publications.ID_TYPE$': '$type_produits.ID_TYPE$'},
        {'$publications.ID_PUBLICATION$': '$images_pub.ID_PUBLICATION$'},
      ],
    },
    include: [
      {
        model: users,
        required: false,
      },
      {
        model: pays,
        required: false,
      },
      {
        model: produits,
        required: false,
      },
      {
        model: type_pub,
        required: false,
      },
      {
        model: images_pub,
        required: false,
      },
    ],
  })
  .then (data_pub => {
    return res.json ({
      statut: true,
      data_pub: data_pub,
    });
  })
  .catch (function (err) {
    console.log (err);
  });
};

my models publications

const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('publications', {
    ID_PUBLICATION: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true
    },
    ID_PRODUIT: {
      type: DataTypes.INTEGER,
      allowNull: false,
      references: {
        model: 'produits',
        key: 'ID_PRODUIT'
      }
    },
    ID_USER: {
      type: DataTypes.INTEGER,
      allowNull: false,
      references: {
        model: 'users',
        key: 'ID_USER'
      }
    },
    ID_QUARTIER: {
      type: DataTypes.INTEGER,
      allowNull: false,
      references: {
        model: 'quartiers',
        key: 'ID_QUARTIER'
      }
    },
    ID_TYPE_PUB: {
      type: DataTypes.INTEGER,
      allowNull: false,
      references: {
        model: 'type_pub',
        key: 'ID_TYPE_PUB'
      }
    },
    CONTENU_PUB: {
      type: DataTypes.TEXT,
      allowNull: false
    },
    TITRE_PUB: {
      type: DataTypes.STRING(255),
      allowNull: false
    },
    PRIX_PRODUIT: {
      type: DataTypes.DECIMAL(11,0),
      allowNull: false
    },
    NOMBRE_PIECE: {
      type: DataTypes.INTEGER,
      allowNull: false
    },
    SUPERFICIE: {
      type: DataTypes.DECIMAL(11,0),
      allowNull: false
    },
    ETAT_PUB: {
      type: DataTypes.BOOLEAN,
      allowNull: false
    },
    DATE_PUB: {
      type: DataTypes.DATE(6),
      allowNull: false,
      defaultValue: "current_timestamp(6)"
    },
    DATE_MODIF_PUB: {
      type: DataTypes.DATE(6),
      allowNull: false,
      defaultValue: "current_timestamp(6)"
    }
  }, {
    sequelize,
    tableName: 'publications',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_PUBLICATION" },
        ]
      },
      {
        name: "I_FK_PUBLICATIONS_PRODUITS",
        using: "BTREE",
        fields: [
          { name: "ID_PRODUIT" },
        ]
      },
      {
        name: "I_FK_PUBLICATIONS_USERS",
        using: "BTREE",
        fields: [
          { name: "ID_USER" },
        ]
      },
      {
        name: "I_FK_PUBLICATIONS_QUARTIERS",
        using: "BTREE",
        fields: [
          { name: "ID_QUARTIER" },
        ]
      },
      {
        name: "I_FK_PUBLICATIONS_TYPE_PUB",
        using: "BTREE",
        fields: [
          { name: "ID_TYPE_PUB" },
        ]
      },
    ]
  });
};

init-model file

var DataTypes = require("sequelize").DataTypes;
var _commentaires = require("./commentaires");
var _images_pub = require("./images_pub");
var _localite = require("./localite");
var _notifications = require("./notifications");
var _pays = require("./pays");
var _produits = require("./produits");
var _publications = require("./publications");
var _quartiers = require("./quartiers");
var _regions = require("./regions");
var _roles = require("./roles");
var _type_pub = require("./type_pub");
var _users = require("./users");

function initModels(sequelize) {
  var commentaires = _commentaires(sequelize, DataTypes);
  var images_pub = _images_pub(sequelize, DataTypes);
  var localite = _localite(sequelize, DataTypes);
  var notifications = _notifications(sequelize, DataTypes);
  var pays = _pays(sequelize, DataTypes);
  var produits = _produits(sequelize, DataTypes);
  var publications = _publications(sequelize, DataTypes);
  var quartiers = _quartiers(sequelize, DataTypes);
  var regions = _regions(sequelize, DataTypes);
  var roles = _roles(sequelize, DataTypes);
  var type_pub = _type_pub(sequelize, DataTypes);
  var users = _users(sequelize, DataTypes);

  quartiers.belongsTo(localite, { as: "ID_LOCALITE_localite", foreignKey: "ID_LOCALITE"});
  localite.hasMany(quartiers, { as: "quartiers", foreignKey: "ID_LOCALITE"});
  regions.belongsTo(pays, { as: "ID_PAYS_pay", foreignKey: "ID_PAYS"});
  pays.hasMany(regions, { as: "regions", foreignKey: "ID_PAYS"});
  publications.belongsTo(produits, { as: "ID_PRODUIT_produit", foreignKey: "ID_PRODUIT"});
  produits.hasMany(publications, { as: "publications", foreignKey: "ID_PRODUIT"});
  commentaires.belongsTo(publications, { as: "ID_PUBLICATION_publication", foreignKey: "ID_PUBLICATION"});
  publications.hasMany(commentaires, { as: "commentaires", foreignKey: "ID_PUBLICATION"});
  images_pub.belongsTo(publications, { as: "ID_PUBLICATION_publication", foreignKey: "ID_PUBLICATION"});
  publications.hasMany(images_pub, { as: "images_pubs", foreignKey: "ID_PUBLICATION"});
  notifications.belongsTo(publications, { as: "ID_PUBLICATION_publication", foreignKey: "ID_PUBLICATION"});
  publications.hasMany(notifications, { as: "notifications", foreignKey: "ID_PUBLICATION"});
  publications.belongsTo(quartiers, { as: "ID_QUARTIER_quartier", foreignKey: "ID_QUARTIER"});
  quartiers.hasMany(publications, { as: "publications", foreignKey: "ID_QUARTIER"});
  localite.belongsTo(regions, { as: "ID_REGION_region", foreignKey: "ID_REGION"});
  regions.hasMany(localite, { as: "localites", foreignKey: "ID_REGION"});
  users.belongsTo(roles, { as: "ID_ROLE_role", foreignKey: "ID_ROLE"});
  roles.hasMany(users, { as: "users", foreignKey: "ID_ROLE"});
  publications.belongsTo(type_pub, { as: "ID_TYPE_PUB_type_pub", foreignKey: "ID_TYPE_PUB"});
  type_pub.hasMany(publications, { as: "publications", foreignKey: "ID_TYPE_PUB"});
  commentaires.belongsTo(users, { as: "ID_USER_user", foreignKey: "ID_USER"});
  users.hasMany(commentaires, { as: "commentaires", foreignKey: "ID_USER"});
  notifications.belongsTo(users, { as: "ID_USER_user", foreignKey: "ID_USER"});
  users.hasMany(notifications, { as: "notifications", foreignKey: "ID_USER"});
  publications.belongsTo(users, { as: "ID_USER_user", foreignKey: "ID_USER"});
  users.hasMany(publications, { as: "publications", foreignKey: "ID_USER"});

  return {
    commentaires,
    images_pub,
    localite,
    notifications,
    pays,
    produits,
    publications,
    quartiers,
    regions,
    roles,
    type_pub,
    users,
  };
}
module.exports = initModels;
module.exports.initModels = initModels;
module.exports.default = initModels;

error

E:Mes CoursMes projetProjet nodeJSImmoMarketControllersPubController.js:9
var models = initModels(sequelize);
^

ReferenceError: sequelize is not defined
at Object. (E:Mes CoursMes projetProjet nodeJSImmoMarketControllersPubController.js:9:25)

Downloading Image locally from GitHub Raw link using fs.writeFileSync() JS

Currently trying to download image from GitHub locally. Everything seems to work, the fetch goes through with a 200 OK response, however, I don’t understand how to store image itself:

const rawGitLink = "https://raw.githubusercontent.com/cardano-foundation/CIPs/master/CIP-0001/CIP_Flow.png" 

const folder = "/Folder"
const imageName = "/Test"
const imageResponse = await axios.get(rawGitLink)


 fs.writeFileSync(___dirname + folder + imageName, imageResponse, (err) => {
   //Error handling                    
 }
)

Validate all input fields on the page on click with jquery

I’m totally new to jquery, but trying my best.

I have an asp.net mvc project with page full of x-editable inputs.
I made this simple button

<input type="button" class="btn btn-info" id="validate" value="Validate document" />

What I want to achieve is after inputs has been filled by the user, I want him/her to push the button and check if all fields has been filled.
I made this jquery:

 $('.editable').ready(function () {
        $('.editable').editable('option', 'validate', function (v) {
            if (!v) return 'Field required!';
        });
    })

When I push enter on an empty field it triggers validation.
enter image description here

What I need is to highlight all empty x-editable fields on the page when the #validate is clicked and show “Field required!” message.

Any help would be appreciated

What happens to old links if i change link domain with the route configurations in branch.io

I have a branch.io app with example.app.link as domain and bunch of links got created where
it opens “ExampleApp” in appstore or playstore.

Now due to some reason i need to change the domain(newexample.app.link or new.example.com) of the link(either sub domain or a new domain completly if subdomain doesn’t work) along with the redirection configurations.
So my new redirection is “ExampleAppNew

Will the previously created links will open the old app or new app or error page?

Preserve HTML Tags in XML Child Node Values While Using XMLSerializer

I am working with the blob API in the latest Chrome and would like to have the following XML DOM added to a new empty object URL:

<root>
  <Title>
   <H1>A Title</H1>
   <H2>A Subtitle</H2>
   Some text or other elements<BR/>
  </Title>
</root>

This piece of XML is selected by the user with their mouse from a content editable DIV. Then I convert that selection into an XML DOM like so:

var n_parser = new DOMParser; //new parser
var small_xml_string = "<root>" + window.getSelection() + "</root>"; //add a root node
var small_xml_obj = n_parser.parseFromString(small_xml_string.toString().replace(/n/g, ""), "text/xml"); //convert user selection to string then to an XML DOM while removing some expected newlines below the selection

The parser however fails to convert any nodes that would have any HTML tags in them, resulting in the following DOM:

<root>
  </Title>
</root>

I’ve tried escaping the the HTML entities but the parser still behaves the same. This was the code I created to try and deal with entities:

var unencoded_title =
  small_xml_string.toString().substring(
    small_xml_string.toString().indexOf("<Title>") + 7,
    small_xml_string.toString().indexOf("</Title>")
    );//Find the string between the title tags
var encoded_title_lt = unencoded_title.replace(/</g, "&lt;");//replace the "<" with "&lt;"
var encoded_title = encoded_title_lt.replace(/>/g, "&gt;");//replace the ">" with "&gt;"
xml_dom.getElementsByTagName("Title")[0].childNodes[0].nodeValue = encoded_title //Add the encoded string to the node, replacing what's there

Note that “xml_dom” is a ready DOM that looks like this:

<root>
    <Title>Example
    </Title>
</root>

The resulting DOM though is exactly the same as if I’d passed the HTML tags in.
Users will be adding HTML tags like
and to the input. How can I process HTML tags in the user input, ready to pass to the blob api?

How to Loop through JSON Objects having Objects and Arrays Inside

{"holders": [{
  "address": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8",
  "balance": 8.623839536582375e24,
  "share": 52.02
},{
  "address": "0xf977814e90da44bfa03b6295a0616a897441acec",
  "balance": 4.5e24,
  "share": 27.14
}]};

The above is a json data, stored in a file, now what I want to do is to loop over this whole file which has 2000 of such entries, get just the address part of each entry and append it in a url, so how would I do the looping part??
Any code Snippet for javaScript would be lovely.
Cudos.