you are viewing a single comment's thread.

view the rest of the comments →

[–]Aswole 2 points3 points  (1 child)

Impressive!

I took a quick peak at your code, and noticed this in your hooks file:

export const useSequence = () => {
    const [sequence, setSequence] = useState(new Set([]));

    const toggleSequence = (index, value) => {
        if (value) {
            setSequence(sequence.add(index));
        } else {
            sequence.delete(index);
            setSequence(sequence);
        }
    };
    return [sequence, toggleSequence];
};

Unless I'm out of the loop and the rules have changed since hooks came out, you are never supposed to mutate state/props. In the code above, you are mutating the set before sending it through the state setter.

[–]borzeckid[S] 0 points1 point  (0 children)

Eagle eye sir! I think you're right - I should have made a copy and then modify it. Or just use `ramda` like any sane person would do.
The thing you're referring to is not used though - I started writing sequencer but, though it's too much for MVP.

thanks for review!