Skip to content

Commit 8526737

Browse files
committed
fix: resolve anonymous memo components in rmc and rmcp
1 parent 6c19189 commit 8526737

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎docs/Snippets.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ export default FileName;
386386
```javascript
387387
import { memo } from 'react';
388388

389-
const FileName = memo(() => {
389+
const FileName = memo(function FileName() {
390390
return <>$2</>;
391391
});
392392

@@ -399,7 +399,7 @@ export default FileName;
399399
import { memo } from 'react';
400400
import PropTypes from 'prop-types';
401401

402-
const FileName = memo((props) => {
402+
const FileName = memo(function FileName(props) {
403403
return <>$2</>;
404404
});
405405

‎src/snippets/generated.code-snippets‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@
487487
"body": [
488488
"import { memo } from 'react'",
489489
"",
490-
"const ${1:${TM_FILENAME_BASE}} = memo(() => {",
490+
"const ${1:${TM_FILENAME_BASE}} = memo(function ${1:${TM_FILENAME_BASE}}() {",
491491
" return (",
492492
" <>${2:first}</>",
493493
" )",
@@ -504,7 +504,7 @@
504504
"import PropTypes from 'prop-types'",
505505
"import { memo } from 'react'",
506506
"",
507-
"const ${1:${TM_FILENAME_BASE}} = memo((props) => {",
507+
"const ${1:${TM_FILENAME_BASE}} = memo(function ${1:${TM_FILENAME_BASE}}(props) {",
508508
" return (",
509509
" <>${2:first}</>",
510510
" )",

‎src/sourceSnippets/components.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const reactFunctionMemoComponent: ComponentsSnippet = {
228228
body: [
229229
...reactWithMemo,
230230
'',
231-
`const ${Placeholders.ComponentName} = memo(() => {`,
231+
`const ${Placeholders.ComponentName} = memo(function ${Placeholders.ComponentName}() {`,
232232
...innerComponent,
233233
'})',
234234
...exportDefault,
@@ -243,7 +243,7 @@ const reactFunctionMemoComponentWithPropTypes: ComponentsSnippet = {
243243
"import PropTypes from 'prop-types'",
244244
...reactWithMemo,
245245
'',
246-
`const ${Placeholders.ComponentName} = memo((props) => {`,
246+
`const ${Placeholders.ComponentName} = memo(function ${Placeholders.ComponentName}(props) {`,
247247
...innerComponent,
248248
'})',
249249
'',

0 commit comments

Comments
 (0)