Skip to content

Conversation

@alamenai
Copy link
Contributor

What

I replaced useMemo with memo() for SpeakerControls.

The previous implementation used useMemo to memoize JSX:

return useMemo(
   () => <SpeakerControls className={className} playerRef={playerRefStatic} />,
   [className]
 )

This is unconventional because:

  • useMemo is designed for memoizing values (calculations, objects, arrays) not components.
  • memo() is the standard React pattern for memoizing components.

I noticed that although we define class as a prop, it isn’t used anywhere in the code.

After inspecting the component, it seems this isn’t intended for developers to use directly.

Additional information

Because this project uses React 19, we can enable the compiler and we remove all these caching hooks and HOC ( useMemo, memo, useCallback ).

@vercel
Copy link
Contributor

vercel bot commented Dec 23, 2025

@alamenai is attempting to deploy a commit to the ElevenLabs Team on Vercel.

A member of the Team first needs to authorize it.

@alamenai alamenai changed the title refactor(radio-speakr): replace useMemo with memo for preventing component re-rendering refactor(readio-speaker): replace useMemo with memo for preventing component re-rendering Dec 23, 2025
@alamenai alamenai changed the title refactor(readio-speaker): replace useMemo with memo for preventing component re-rendering refactor(radio-speaker): replace useMemo with memo for preventing component re-rendering Dec 23, 2025
@louisjoecodes
Copy link
Collaborator

Helpful and good to know thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants