SIGN IN SIGN UP
facebook / react UNCLAIMED

The library for web and native user interfaces.

0 0 0 JavaScript

Use .slice() for all substring-ing (#26677)

- substr is Annex B
- substring silently flips its arguments if they're in the "wrong order", which is confusing
- slice is better than sliced bread (no pun intended) and also it works the same way on Arrays so there's less to remember

---

> I'd be down to just lint and enforce a single form just for the potential compression savings by using a repeated string.

_Originally posted by @sebmarkbage in https://github.com/facebook/react/pull/26663#discussion_r1170455401_
S
Sophie Alpert committed
767f52237cf7892ad07726f21e3e8bacfc8af839
Parent: c826dc5
Committed by GitHub <[email protected]> on 4/19/2023, 9:26:01 PM