no-reducer
  • πŸš€Introduction
    • ☺️Demonstration
  • πŸ–₯️Installation
  • πŸ“–No-Reducer Actions
    • 🎯destination path
    • create
      • create an object/array
    • insert
      • insert to an array item
    • remove
      • remove with condition
      • remove without condition
    • replace
      • replace with condition
      • replace without condition
    • update
      • update with condition
    • append
    • clear
      • clear an array item
Powered by GitBook
On this page
  1. No-Reducer Actions
  2. create

create an object/array

Create nested objects and arrays I will create my own jsondata with nested objects and arrays called MyClass

dispatch(create('MyClass', 
{
name: 'Computer',
students: [
    {
        id: 1,
        name: 'Bill Gate',
        companies: [{ cid: 1, name: 'Microsoft', found: 1975 }]
    },
    {
        id: 2,
        name: 'Steve Jobs',
        companies: [{ cid: 2, name: 'Apple', found: 1976 }]
    },
    {
        id: 3,
        name: 'Elon Musk',
        companies: [{ cid: 3, name: 'Tesla', found: 2003, 
        cars: [
        { mid: 1, n: 'Model X' }, 
        { mid: 2, n: 'Model Y' }, 
        { mid: 3, n: 'Model S' }] }, 
        { cid: 4, name: 'Paypal', found: 1999 }],
    },
    {
        id: 4,
        name: 'Mark Zuckerberg',
        companies: [{ cid: 5, name: 'Facebook', found: 2004 }]
    },
]
}));

PreviouscreateNextinsert

Last updated 2 years ago

πŸ“–