TypeError: c is not a function


If you’re building blocks for WordPress, and the error TypeError: c is not a function is logged in your browser’s developer console, you may have created a TextControl component and failed to include both value and onChange attributes.

This code will cause the error:

<TextControl
	label={ __( 'Cash/trade', 'invp-payment-calculator' ) }
	id={ 'trade' }
	onChange={ changeTradeValue }
</TextControl>

This is a correct syntax:

	label={ __( 'Cash/trade', 'invp-payment-calculator' ) }
	id={ 'trade' }
	value={ attributes.trade }
	onChange={ changeTradeValue }
</TextControl>

Leave a Reply

Your email address will not be published. Required fields are marked *