Is redux Toolkit only used for Hooks ? If not please provide official documentation and video content online!
if possible please provide any youtube videos link which explains Redux Toolkit in Class components
React class components are pretty much legacy at this point - you should really not be writing new code with them, as most new libraries do not provide functionality for it. The whole ecosystem is shifting towards a hooks-only approach since 2019.
But apart from that, React Toolkit is completely platform independent (apart from the RTK-Query /react
entrypoint, which only provides hooks - see reasoning above).
You use Redux Toolkit with React - just like plain Redux - using the react-redux
library, which provides the useSelector
and useDispatch
hooks as well as the connect
function, which can be used to use Redux (with or without Toolkit) with class components.
connect
is at this point considered a legacy api. It will stay around for the forseeable future, but might work less well in some edge cases of future React 18, since React 18 is really tailored around concepts that do not work well with class components.
If you need information on that, please see the React-Redux documentation, not the Redux Toolkit documentation.