A
A
Arthur2019-03-21 12:27:43
JavaScript
Arthur, 2019-03-21 12:27:43

How to create model from js data?

Given data

data = {
      article: {
          id: ['1', '2', '3', '4'],
          description: ['blah1', 'blah2', 'blah3', 'blah4'],
          date: ['1992', '1996', '1993', '1994'],
      },
      colors: {
          id: ['1', '2', '3', '4'], //id article
          attribute : ['eee,fff', 'ddd', 'eee,ppp,ooo', 'rrr,ddd,xxx,zzz'],
      },
}

You need to process them and make a model. For further output in the react table component, with a filter, for example, by date and a display with the desired color. How is this done correctly, namely the creation of a model?
I understand the data needs to be brought to mind?
artcles [
  {
    id: 1,
    description: 'blah1',
    date: '1992',
    color: [
      'eee',
      'fff'
    ]
  }

  {
    id: 2,
    description: 'blah2',
    date: '1996',
    color: [
      'ddd',
    ]
  }
]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question