mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00
Improved error handling when lambda expression missing =>
This commit is contained in:
parent
6839b7506b
commit
aae2411c23
@ -110,6 +110,9 @@ function generateProps(node, context) {
|
||||
}
|
||||
if (key.indexOf('on') === 0 && !isStringOnlyCode(val)) {
|
||||
var funcParts = val.split('=>');
|
||||
if (funcParts.length !== 2) {
|
||||
throw 'when using "on" events, use lambda "(p1,p2)=>body" notation or use {} to return a callback function. error: [' + key + '="' + val + '"]';
|
||||
}
|
||||
var evtParams = funcParts[0].replace('(', '').replace(')', '').trim();
|
||||
var funcBody = funcParts[1].trim();
|
||||
var params = context.boundParams;
|
||||
|
Loading…
x
Reference in New Issue
Block a user