Redux Toolkit / RTK Query
unwrap
Extracts fulfilled payload or throws a rejection from a dispatched async thunk.
Formal Syntax & Structure
react syntaxreact
await dispatch(loadStock(id)).unwrap()Working Example
Example Snippetreact
await dispatch(loadStock(id)).unwrap()