shlogg · Early preview
Joodi @miladjoodi

Dynamic Flex Direction Adjustment Based On Language

Dynamic Flex Direction Hook Use `useFlexReverse` hook to automatically adjust flex direction based on language (RTL/LTR). Returns "flex-row-reverse" for English & "flex-row" for Persian & others. Simplify localization with this reusable hook!

This hook is particularly useful in multi-language websites where you want to adjust the layout direction based on the selected language (e.g., English and Persian). In some languages, like Persian (FA), content is read right-to-left (RTL), while in languages like English (EN), content is read left-to-right (LTR). If you need to dynamically reverse the direction of flex items based on the language, this hook provides a simple solution.



  
  
  How It Works

When the language is set to English (en), this hook will return a class that applies a right-to-left (RTL) flex direction (flex-row-rev...