I am rendering some navigation steps in React and am mapping through an array. Currently I have a isDisabled prop as a boolean that will take pointer events away if the condition is met. I want to be able to have previous links/steps in the array be accessible but have future steps disabled. All my logic seems to get some of them working but usually will skip one. I've tried something like
isDisabled = i > (i + stepLength - 1) % stepLength
where stepLength is just the length of the array (which is 4). All questions I've seen answered have just been for the immediate next or previous step and doesn't account for multiple previous or future indexes in the array.