Web API
Response.ok
Boolean indicating a successful HTTP status in the 200–299 range.
Formal Syntax & Structure
react syntaxreact
response.okWorking Example
Example Snippetreact
if (!response.ok) throw new Error("Request failed");Boolean indicating a successful HTTP status in the 200–299 range.
response.okif (!response.ok) throw new Error("Request failed");