I've been using React for quite some time now and it's an amazing tool to write maintainable applications pretty fast. But I remember when I starte...
For further actions, you may consider blocking this person and/or reporting abuse
I've had to use the <> </> a few times, and also returned elements inside arrays a few times too, after this adjacent JSX error came up. Finally I understood why is the way is it. Thanks for the nice article.
Glad I could help.
Nice explanation. I have also written a similar article some time back with additional details which you can check out here
I checked it out, good work.
Check out his article to see more about how React.createElement works.
Thank you so much!
You can always return
Yes I said we can return arrays
What if React could automatically add <>, </> around these adjacent JSX elements?
But your program will never reach that stage when React can do anything. Wrong syntax will break your program in the first place. Please abide by the rules of JavaScript as React is just JavaScript.
I mean, while compiling, can’t React intelligently figure it out and add a parent block? I know it doesn’t do that now but it is quite possible isn’t it?
That is asking too much 😅
React is just a library.
Great writeup!
Thank you so much :)
You get that error because you can only return one thing at any given time. That error translates to "do something so you will only return one thing".
I know it asks you to return one element. In this article I'm trying to explain WHY does it want you to return one element.
Great post and explanation !!
Thank you, Paras :)