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

Migrating to @portabletext/react #40

Closed
nutgaard opened this issue Aug 20, 2023 · 2 comments
Closed

Migrating to @portabletext/react #40

nutgaard opened this issue Aug 20, 2023 · 2 comments

Comments

@nutgaard
Copy link

Been getting a warning in the console when using this package;

Warning: SanityBlockContent: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

By the looks of it this is due to how @sanity/block-content-to-react works. The package has been deprecated, and it is recommended to migrate to @portabletext/react.

@coreyward
Copy link
Owner

I had proposed switching over when @portabletext/react was quite new, but was cautioned against it by the author. In the wild, I still see a lot of people having issues with it in general, and particularly when using TypeScript, so I am not in a particular rush to switch. For example, this issue has bitten many people, and the fact that the file was named the same as this library has created confusion, as demonstrated.

This being said, I do expect to transition to using @portabletext/react in the next major version, which will really just be when it seems that it's stable enough to create a good experience. There is also the possibility of removing the need for an additional dependency to do this if @portabletext/react remains too troublesome or unstable (3 major versions in a little over a year).

@coreyward
Copy link
Owner

Circling back to this, I think that the changes the Sanity team has made to @portabletext/react address many of the pain points that led me to create react-portable-text. I've been using it directly for several months now without issues and I think it's worth migrating to for most people, but there isn't any pressing need to migrate if you're happy with react-portable-text for now.

If someone in the community feels strongly enough that this isn't the case and wants to work together on revising this library to work on top of @portabletext/react I'm open to it. Otherwise, though, I think the right course of action for most people is to migrate when they feel it's time. I'll continue to maintain this for the time being, though.

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

No branches or pull requests

2 participants