use-lang-direction
June 30, 2020 ยท View on GitHub
A React hook that reads the HTML element's dir attribute value and any updates to that value allowing you to update your UI accordingly.
In Action
Basic Usage
import React from "react";
import { useLangDirection } from "use-lang-direction";
const App = () => {
const langDir = useLangDirection();
return (
<div >
<input dir={langDir} type="text" />
</div>
);
};
License
MIT