From da1d031ff8479e57da013a03e482d429e68519b3 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 26 Jan 2016 15:03:13 -0800 Subject: [PATCH] [guide] [react] add a note preferring normal functions for functional stateless components. --- react/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/react/README.md b/react/README.md index ee9e32ca..5ea9b524 100644 --- a/react/README.md +++ b/react/README.md @@ -47,7 +47,7 @@ } ``` - And if you don't have state or refs, prefer functions over classes: + And if you don't have state or refs, prefer normal functions (not arrow functions) over classes: ```javascript @@ -58,6 +58,11 @@ } } + // bad (since arrow functions do not have a "name" property) + const Listing = ({ hello }) => ( +
{hello}
+ ); + // good function Listing({ hello }) { return
{hello}
;