-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix: return a jsx elemnet instead of string #8493
Conversation
@BWizard06 Thanks for your PR! If this isn't working, it sounds to me like a problem with our types, rather than the code in the tutorial export const Success = ({ article }: CellSuccessProps<ArticleQuery>) => {
return JSON.stringify(article)
}
What's the exact error you're getting? |
Hello @Tobbe . I am getting following error if i don't return it in a div: |
How are you using |
Yeah sure. I have made a github repo. In this repo the error still remains as you had wished. https://github.com/BWizard06/redwoodblog/blob/master/web/src/pages/ArticlePage/ArticlePage.tsx |
Thank you, that's really helpful. I can confirm that I'm seeing the same thing But there are no errors inside the cell itself If you click through into the types for ArticleCell you'll end up in And I think this is wrong. You can see the type Redwood uses for the Success component here
I'm not sure yet how they should change, but I think @BWizard06 Do you want to try to look into how to fix the types? No pressure, just an open invitation 🙂 If you don't want to or don't have time to try to fix it, I or someone else from the RW team will do it instead. |
Honestly I would really like to but I am pretty new and don't quite understand how I could change the type of the article, so that it accepts the type string. I think this is the key error: |
Yeah, let's do that for now. And then I can fix our types later 🙂 |
Thanks for your PR @BWizard06. Much appreciated 👍 |
Co-authored-by: Tobbe Lundberg <[email protected]>
Glad I could help😊 |
The Success Component now returns a JSX Element instead of a string, which leads to an Error in the ArticlePage. Instead of return JSON.stringify(article) it is now return