I was trying to use redux in my react application but I see I can explicitly use redux in my application without using the react-redux library.
const redux = require('redux');
I am wondering then why do we even need react-redux library in our environment? Can someone help me with this?
Redux is an UI-library-agnostic state management library. React is a state-management-agnostic UI library.
React-Redux is glue between the two. You don't need it, but you'd have to implement the glue (hooks/HOCs) yourself.
react-redux contains in particular the Provider component and the useDispatch and useSelector hooks.
If you are using them, you're using react-redux. If you are not using them, you're missing out a lot, so I suggest you do.
In short:
React-redux is what makes your components rerender when Redux state that is being rendered by your component changes.
Of course you could also do store.getState().foo.bar in your component, but then you would have to track manually when that state changes and rerender your component. Otherwise, it would always stay the same and never update.
If you instead use useSelector(state => state.foo.bar), your component will always rerender when state.foo.bar changes, so you don't have to track that yourself.