Please tell me how to combine the two reaction objects :D

Asked 2 years ago, Updated 2 years ago, 101 views

const a = [
    {market: "KRW-BTC", Korean_name: "Bitcoin", English_name: "Bitcoin"},
    {market: "KRW-ETH", Korean_name: "Etherium", English_name: "Etheum"},
    {market: "KRW-NEO", Korean_name: "Neo", English_name: "NEO"},
    {market: "KRW-MTL", Korean_name: "Metal", English_name: "Metal"},
    {market: "KRW-LTC", Korean_name: "Litecoin", English_name: "Litecoin"},
    {market: "KRW-XRP", Korean_name: "Ripple", English_name: "Ripple"},
    {market: "KRW-ETC", Korean_name: "Etherium Classic", English_name: "Etherium Classic",
    {market: "KRW-OMG", Korean_name: "Omisego", English_name: "OmiseGo"},
    {market: "KRW-SNT", Korean_name: "Status Network Token", English_name: "Status Network Token",
    {market: "KRW-WAVES", Korean_name: "Wave", English_name: "Waves"},
    {market: "KRW-XEM", Korean_name: "Nem", English_name: "NEM"},
    {market: "KRW-QTUM", Korean_name: "Quantum", English_name: "Qtum"},
    {market: "KRW-LSK", Korean_name: "risk", English_name: "Lisk"}
];

const b = [
    {market: "KRW-BTC", trade_date: "20210506", trade_time: "144435", trade_date_kst: "20210506", trade_time_kst: "234435"},
    {market: "KRW-ETH", trade_date: "20210506", trade_time: "144436", trade_date_kst: "20210506", trade_time_kst: "234436"},
    {market: "KRW-NEO", trade_date: "20210506", trade_time: "144436", trade_date_kst: "20210506", trade_time_kst: "234436"},
    {market: "KRW-MTL", trade_date: "20210506", trade_time: "144432", trade_date_kst: "20210506", trade_time_kst: "234432"},
    {market: "KRW-LTC", trade_date: "20210506", trade_time: "144433", trade_date_kst: "20210506", trade_time_kst: "234433"},
    {market: "KRW-XRP", trade_date: "20210506", trade_time: "144436", trade_date_kst: "20210506", trade_time_kst: "234436"},
    {market: "KRW-ETC", trade_date: "20210506", trade_time: "144437", trade_date_kst: "20210506", trade_time_kst: "234437"},
    {market: "KRW-OMG", trade_date: "20210506", trade_time: "144437", trade_date_kst: "20210506", trade_time_kst: "234437"},
    {market: "KRW-SNT", trade_date: "20210506", trade_time: "144434", trade_date_kst: "20210506", trade_time_kst: "234434"},
    {market: "KRW-WAVES", trade_date: "20210506", trade_time: "144436", trade_date_kst: "20210506", trade_time_kst: "234436"},
    {market: "KRW-XEM", trade_date: "20210506", trade_time: "144436", trade_date_kst: "20210506", trade_time_kst: "234436"},
    {market: "KRW-QTUM", trade_date: "20210506", trade_time: "144436", trade_date_kst: "20210506", trade_time_kst: "234436"},
    {market: "KRW-LSK", trade_date: "20210506", trade_time: "144436", trade_date_kst: "20210506", trade_time_kst: "234436"},
];

There are two like this, and I want to merge these two based on the market. Is there a way to merge? I'm not sure if I'm a beginner at React.

react javascript

2022-09-20 16:31

1 Answers

Summarizing the arrays is

Array.prototype.concat(array1, arrya2...)

You can do it like this!


2022-09-20 16:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.