I've been starting projects using cli or starter templates lately and one of the things I've noticed is how many pieces of code are included that w...
For further actions, you may consider blocking this person and/or reporting abuse
Not that there's a use for this, but is there a way to assign names to the imports when running
For example, is there a way to import
App
asWhatever
andPost
asThing
?Yup!
If it's a named import it's this.
Nice article. You just haven't talked about the
*
globber forimport
. You can use it to import everything from a module under a "namespace".Definitely an important thing to know. I tried to keep it bite sized, so I didn't cover every part of imports and exports (like aliases). But great to have in the comments as additional information :)
Excellent approach. It's so easy how we get lost about using frameworks and not understand what it does.
Another interesting style is introducing alias:
Definitely. Another nice piece of syntax to understand.
Thank you Laurie. That is by far the best explanation I have read on this subject. Well done you! Keep up the excellent work.
Thank you so much!
As someone who doesn't use React, I'm curious as to why so much biolerplate code is even needed for a basic simple one line of text? I work in the Altaform framework, and it would literally just be the line of text with zero boilerplate, and it would just work.
So this is defining a component that can then be used on multiple pages. Components can have the render function as well as other functions, styles, etc. I’ll be doing another post on that.
But frameworks come with different strengths and different “powers”. They all have use cases where they make more sense.
because the point of the library isn't "a basic simple one line of text." the point is create much larger and much more complex applications. once you're in the react ecosystem you have a much larger toolset to pull from than if you were just generating html strings with your own homegrown solution.
Great post, really clear explanation and examples. I think it's very helpful to take a small piece like this, that we see everyday, and break it down. Well done!
This explanation is so helpful and clear. I finally feel I fully understand imports and exports.
So glad it resonated with you!
Very well put together article.
Nice article, Laurie. Thanks for sharing.