I'm learning reactJS, how can I write a value from AddCategoryModal.jsx <input type"text" id="addValue"/> to objects in data.js file?
the values store in memory, it will wipe itself after the browser refresh, I want to add bus value to write on object in data.js.
in AddCategoryModal.jsx file:
data.push({categoryName:"Bus", lists:['Location']}); // store value from input
in data.js file:
export const data = [
{
categoryName: 'Restaurants',
lists: [
'Can I please have the menu',
'Is my order ready?',
'What are your main dishes',
'Where is the manager?',
'May I sit in this table?',
],
},
{
categoryName: 'Security Guard',
lists: [
'Can you please assist me?',
'Can i come in , I came to visit my friend . I have an appoinment',
'I am lose, can you help ,e with directions',
],
},
{
categoryName: 'Garage',
lists: [
'How much is 1Litre petrol',
],
},
]