score:0
i hope i got the structure right, based on your last comment. i suggest creating a joint structure (e.g. joint array) of the two entities, which will be made of objects that have the props of user and also the two props "last used", "quarantined till" which will be taken from licensed users.
example of the joint structure: ("" used instead of actual data)
jointarr = [
{
user_name: "user 0",
user_directory: "",
assigned: "",
display: "block",
last_used: "",
quarantined_till: "",
},
{
user_name: "user 1",
user_directory: "",
assigned: "",
display: "block",
last_used: "",
quarantined_till: "",
},
...
...
];
in order to generate this structure, you will be iterating over users, while checking on licensed users if the current user belongs to that table as well:
const jointarr = [];
// users refers to users array
// licensedusers refers to licensed users array
users.foreach((user) => {
const licenseduser = licensedusers.find(
(lcuser) => lcuser.user_name === user.user_name
);
let lastused = "";
let quarantinedtill = "";
if (licenseduser) {
lastused = licenseduser.last_used;
quarantinedtill = licenseduser.quarantined_till;
}
jointarr.push({
user_name: user.user_name,
user_directory: user.user_directory,
assigned: user.assigned,
display: user.display,
last_used: lastused,
quarantined_till: quarantinedtill,
});
});
Source: stackoverflow.com
Related Query
- How to iterate a table of information with two different arrays made into one
- How do I combine two arrays in react to get a new one with all of the items from the previous two?
- How to render two different arrays data into a single array of objects?
- How to compare two different arrays with common properties
- A lookup function to match the same IDs in two different arrays of objects and inserting key/value pairs into one of the array of objects
- Merge two arrays of different objects into one array of objects combined from the first two
- How to model a HTML table with two cells per column in React?
- How to work with two different APIs with React?
- How to run one 'npm start' for two different folders in my project directory
- How to create a table with multiple rows in one row (Material-UI/CSS)
- How do I dynamically insert html table cell data into a table with dynamic headers in React?
- JavaScript how to map over two arrays one object
- Merging two arrays into one that has the same amount of objects
- Conditionally mapping two different arrays into a React component depending on boolean value
- How to make multiple HTTP requests with RxJS and merge the response into one payload and map it to another action?
- How to generate React table with different colored rows?
- How to return the data in one function call for two different object keys
- Convert two arrays to one object, with same key for each array in Javascript
- On an HTML form with two buttons, how can I get one button to submit the form and the other one not?
- React.js: How can I download two different files with two different separate Button components?
- Merge two arrays into one Array of objects React
- How do I extract two arrays from a JSON with nested objects
- How to display data from 2 separate arrays in one table in React Js?
- How can I iterate through JSON arrays and show data in a table in React
- How would one do two way data binding with react, having an input value A update when B is, and vice versa?
- Create a component that represent two table with OneToMany relation in one table
- Show a pop-up window with information coming from an element and its totals, from one of the table in react.js
- How to map elements into two table columns, two elements per row?
- Using .map to iterate on two different arrays at the same time
- How can I break through React maps to display object that has two values one with an array other with string or number(result)
More Query from same tag
- Redirect to Homepage or any page
- Next.js: Link to element in a component on the same page
- React JS view not re-rendering on setState()
- ReactJS assign click handler in for loop
- React form not populating data
- How do I protect a path in React?
- firebase.database() is not a function error in react
- How can I put tabs in the same row as the header in React Material-UI? (codesandbox included)
- Can't call setState on a component that is not yet mounted, even though it is?
- Django Rest Framework + ReactJS: Whats wrong with my API?
- Is it bad to use Refs to change styles in react?
- JavaScript: Multiple cropping selection in one image?
- Avoid render html node on react using react-lazyload
- Highlight current date in react Gantt timeline
- Tailwindcss nextjs JIT mode compile error
- Cannot figure out why useState hook is not updating properly
- React hook with Material UI
- How to configure Ckeditor Toolbar in React JS?
- how to add simple className and fucntion return at the same time in react
- Have React component trigger a change event the way DOM components would
- Why is req.query always empty?
- Hooks and webworkers
- Jest tests on React components: Unexpected token "<"
- React.js Toggling Display
- Can a React component render another component stored in it's state?
- How to programmatically navigate using react router
- onDrag event clientX is always 0 in Firefox
- React useState hook returns old state value despite it being updated
- How to use react-select with api
- how do i add a line break to a text from react state