#styled components
1 messages Β· Page 1 of 1 (latest)
You should be able to do it with css only:
unicode-bidi:bidi-override;
direction:rtl;
You just need to setup your styled component to apply the css conditionally based on a prop
Thanks for telling me another way but this is how ania the teacher of this course did it i was just wondring why it works without the join method
Oh sorry I misunderstood your question haha The reason why it works is because you pass on a string, which you split then reverse. The end result is a reversed array which you obviously know.
When you pass in an array of primitive values in our case an array of string, react will make text nodes out of each member and render it to the DOM
Now the problem with this approach , that the children element can be string, array, jsx element (object defined in a particular way) etc... So this approach would only work with strings.
You could follow an approach where you "clone" the react child elements and check their type and you only perform the splitting and reversing when it is a string.
React gives is utility functions to do that, if you are interested I could make you a demo.
Thanks and no need for demo i get you π
I am not doing it for the hearts π but thanks
just so you can get the scrimba hoodie π
I have 1 and a mug π
I didn't even know you can use these points until 6-8 months haha
it was a nice surprise
it seems like you helped a lot of people π
It's a 2 way road. π I've learnt a lot by "trying" to help and if I manage to help then we are both happy haha
actually yeah that is true when you explain something to some you understand it better
Exactly π You might also do some more research to make sure you are telling them the right thing.
I'm from Hungary, what about you?
Egypt
my brother lives in Graz , I think it should be somewhere near you
but not like near you
Oh nice!! π
Yes, it's very close to use π
I've actually move to the UK about 8 years ago π
oh so you live now in Uk
yes π