Coding a block: capitalized `Edit` but not `save`?
-
I don’t get why in the code created by
@wordpress/create-block
, as well as in the first sample block, the edit function is named with a capital letter (Edit
), but the save function is lower-case (save
).I guess there is an argument for both choices:
- Capitalized: Those functions return a DOM Element and thus define a React element. So, following React conventions,
Edit
makes sense. - lower case: They are apparently not used as React elements through JSX, and using a lower case also works (and is used in other examples).
Considering both functions are of the same types, with similar use, I feel like it should be one or the other. Any reason why capitalizing
Edit
but notsave
?The page I need help with: [log in to see the link]
- Capitalized: Those functions return a DOM Element and thus define a React element. So, following React conventions,
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Coding a block: capitalized `Edit` but not `save`?’ is closed to new replies.