Answer the question
In order to leave comments, you need to log in
The state of the array changes only once. What to do?
At the beginning of the code, I declare arr and nexIdx:
let arr = Array(100).fill(1).map((v,i) => v + i);
let nextIdx = Math.floor((arr.length / 2) - 1);
<Button title='Меньше' onPress={() => arr = arr.slice(0, nextIdx - 1)} />
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question