title: Difference between createSelector and createDraftSafeSelector API in Redux Toolkit
body: <p><code>createSelector</code> mentioned at <a href="https://github.com/reduxjs/reselect" rel="nofollow noreferrer">https://github.com/reduxjs/reselect</a></p>
  <blockquote>
  <p><code>createSelector</code> API, which generates memoized selector functions.
  createSelector accepts one or more &quot;input&quot; selectors, which extract
  values from arguments, and an &quot;output&quot; selector that receives the
  extracted values and should return a derived value. If the generated
  selector is called multiple times, the output will only be
  recalculated when the extracted values have changed.</p>
  </blockquote>
  <p><code>createDraftSafeSelector</code> mentioned at <a href="https://redux-toolkit.js.org/api/createSelector" rel="nofollow noreferrer">https://redux-toolkit.js.org/api/createSelector</a></p>
  <blockquote>
  <p><code>createDraftSafeSelector</code> allows to create selectors that can
  safely be used inside of <code>createReducer</code> and <code>createSlice</code> reducers with
  Immer-powered mutable logic. When used with plain state values, the
  selector will still memoize normally based on the inputs. But, when
  used with Immer draft values, the selector will err on the side of
  recalculating the results, just to be safe.</p>
  </blockquote>
  <p>I am new to <a href="https://reactjs.org/" rel="nofollow noreferrer">react</a> and <a href="https://redux.js.org/" rel="nofollow noreferrer">redux</a> design patterns so could not understand the difference and purpose of <code>createDraftSafeSelector</code>.</p>
  <p>What is the difference in both API? What can be an example to understand the difference?</p>