ref(react): Improve React Router instrumentation docs #10837
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While creating a small react router test app, I tried to apply our RR6 routing instrumentation and ran into every possible pitfall along the way. First, I imported the hooks from the wrong packages, then I missed that I need to apply
wrapCreateBrowserRouter
and ultimately (not my proudest moment lol) missed callingsentryCreateBrowserRouter
.Because IMO it's really easy to fall into at least one of these problems, I thought, our code snippet highlighting feature would work well here because the setup is (compared to other routing instrumentations) quite involved. So this PR adds some highlighting to the various RR version code snippets and slightly streamlines wording.
Example:
Note: All snippet highlights assume that
Sentry.init
was already set up beforehand which I think is a fair assumption, given this is a guide on a sub-page.