fix: React warning related to "true" used as boolean (via #5497)

This should fix this warning seen in the console when using `swagger-ui-react`:

```
Warning: Received the string `true` for the boolean attribute `readOnly`. Although this works, it will not work as expected if you pass the string "false". Did you mean readOnly={true}?
    in textarea (created by Curl)
    in div (created by Curl)
    in div (created by Curl)
    in Curl (created by LiveResponse)
    in div (created by LiveResponse)
    in LiveResponse (created by Responses)
```

I did not test this change because it's trivial and there is no behavioural change here, React treats non-empty string attributes as `true`.
This commit is contained in:
silverwind
2019-08-23 06:27:58 +02:00
committed by kyle
parent 0b3489b52d
commit f5a3d8854d

View File

@@ -20,7 +20,7 @@ export default class Curl extends React.Component {
<div>
<h4>Curl</h4>
<div className="copy-paste">
<textarea onFocus={this.handleFocus} readOnly="true" className="curl" style={{ whiteSpace: "normal" }} value={curl}></textarea>
<textarea onFocus={this.handleFocus} readOnly={true} className="curl" style={{ whiteSpace: "normal" }} value={curl}></textarea>
</div>
</div>
)