Skip to content

Conversation

@sweber-lr
Copy link
Contributor

@sweber-lr sweber-lr commented Dec 11, 2025

Updating the logrocket-react package to be compatible with React 19 by no longer using the internal functions and instead directly looking at internal properties on click event targets. This has been tested to work on production builds of React.

I tested this by running npm run build, then npm pack and then installed the generated package into a new React 19 test app and then ran that app using the production version of React and pointed it at the apphub/logrocket project in PROD. You can see example sessions where the component name is captured and can filtered by here.

I also added typings for the package and updated the README to include instructions on how to install the package for React 18 too.

Comment on lines -13 to +17
return <div ref="button" onClick={() => {}} />;
return <div ref={this.buttonRef} onClick={() => {}} />;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to update our usage of refs in the test code since string-based refs are no longer allowed in React

"peerDependencies": {
"logrocket": ">=2.0",
"react": ">=18",
"react-dom": ">=18"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency on react-dom has been removed since we are no longer using the internal tools from it.

@sweber-lr sweber-lr requested a review from eranimo December 11, 2025 18:51
@sweber-lr sweber-lr merged commit eb93129 into master Dec 17, 2025
1 check passed
@sweber-lr sweber-lr deleted the react-19-support branch December 17, 2025 19:25
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.

3 participants