O
O
Olga2018-02-13 13:23:39
React
Olga, 2018-02-13 13:23:39

How to write in one line?

const currentSorting = location.query.sort_direction || pageContents.books.default_sort[activeList];
    const sort_direction = currentSorting === 'desc' ? 'desc' : 'asc';

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2018-02-13
@vshvydky

const sort_direction = location.query.sort_direction ? location.query.sort_direction : pageContents.books.default_sort[activeList];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question