• 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 not save?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • I asked myself the same question this week when I looked at some older programming of mine that was based on the examples you mentioned. I tried it out: the spelling does not matter. In the end it is only important that the associated function is present and can be loaded.

Viewing 1 replies (of 1 total)
  • The topic ‘Coding a block: capitalized `Edit` but not `save`?’ is closed to new replies.