How to use moveUp/moveDown

Hi guys, I am relatively new to using react and conforms and I ran into a bit of an issue using the moveUp and moveDown functions for an array. My main goal is to move a list item multiple spaces at once is this possible?

When using moveUp/Down inside an onClick event everything happens like it’s supposed to however I can’t get it to work outside of this. Is it possible to use this inside a custom function?

onClick={moveUp(path,index)} works :white_check_mark:
onClick={() => moveUp(path,index} doesn’t work :x:
onClick={customFunction(path,index)} doesn’t work :x:

Any help would be appreciated!
Thanks, guys

Hi @Red-Bog,

These are function factories returning an event handler function. So your second example needs to be modified to

onClick={() => moveUp(path,index)()}

to work. Your third example onClick={customFunction(path,index)} can work, depending on what you do in customFunction.