Why is onChange={ ( content ) => setAttributes( { content } )} now used?

Because { content } is shorthand for { content: content } it’s a JS thing not a WordPress thing.

Both methods work and do the same thing, but the { content } syntax is shorter, so the variable was named content in newer examples to allow it.

Otherwise, there are no security or performance improvements, it’s just a shorter syntax for the same thing.

Leave a Comment