Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

81
Views
Use imports with string that comes from localStorage

I need to show/hide different menu based on rights that are send from database and saved in localStorage.

Here is the imported menus

import tripOrders from './tripOrders';
import orders from './orders';
import employees from './employees';

Then I use them here:

const menuItems = {
    items: [tripOrders, orders, employees]
};

I tried to make something like this, but nothing happens.

let menuFromDB = localStorage.getItem('menu-items') // <== in 'menu-items' I set tripOrders, orders, employees

const menuItems = {
    items: [menuFromDB]
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You get a string from localStorage, so you can use split() to convert it to the array

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!