Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update examples to use newer React syntax #119

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

agilgur5
Copy link
Owner

@agilgur5 agilgur5 commented Feb 11, 2025

Summary

Update examples to latest React syntax; createRoot + hooks

Details

  • use createRoot for react-dom rendering
  • use functional components with hooks syntax

Misc docs/example improvements

  • add link to ref docs

  • consistently use sigCanvas as name

    • don't switch b/t sigPad and sigCanvas
  • consistently format example/ dir with ts-standard

    • was previously ignored for less diff, but since the example is re-written with newer syntax, good timing to reformat it too

Verification

npm start example runs, renders, clears, and trims

Future Work

  1. Update the gh-pages branch as well
  2. Update the cra-example branch used for the CodeSandbox as well

EDIT: Completed both, see below comment

- use `createRoot` for `react-dom` rendering
- use functional components with hooks syntax

- add link to `ref` docs
- consistently use `sigCanvas` as name
  - don't switch b/t `sigPad` and `sigCanvas`

- consistently format `example/` dir with `ts-standard`
  - was previously ignored for less diff, but since the example is re-written with newer syntax, good timing to reformat it too
@agilgur5 agilgur5 added the scope: docs Documentation could be improved label Feb 11, 2025

This comment was marked as resolved.

Copy link
Owner Author

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

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

✅ LGTM

@agilgur5 agilgur5 merged commit 678e868 into main Feb 11, 2025
8 checks passed
@agilgur5 agilgur5 deleted the example-update-react-syntax branch February 11, 2025 16:35
@agilgur5 agilgur5 added the scope: example An example or examples could be improved label Feb 11, 2025
@agilgur5
Copy link
Owner Author

agilgur5 commented Feb 14, 2025

  1. Update the gh-pages branch as well

Completed now. Had to do a solid amount of rebasing and editing to update this to latest, but it works now and is, as it was before, only a few commits on top of main

  1. Update the cra-example branch used for the CodeSandbox as well

Also completed now, but differently than written. As CRA is now deprecated (facebook/create-react-app#17003), I made the CodeSandbox use parcel instead. As this is the same as the example/ dir and gh-pages branch, there was only 1 commit more necessary to align with CodeSandbox's required directory structure.

See the new codesandbox-example branch live on CodeSandbox

@agilgur5
Copy link
Owner Author

See the new codesandbox-example branch live on CodeSandbox

Docs were updated to this new link in #120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: docs Documentation could be improved scope: example An example or examples could be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant