Как вызвать функцию из другого файла?
mixin checkbox-buttons(params)
.expandable-checkbox-list(id=params.inpId, type='button', onclick='testfunc()' )
.expandable-checkbox-list__caption
h3.expandable-checkbox-list__text= params.caption
.expandable-checkbox-list__expand-more.material-icons expand_more
функция находится в файле test.js
function testfunc(){
alert('hello');
}
по клику на элемент ничего не происходит
все js файлы подключаются в главный index.js так
function requireAll(requireContext) {
return requireContext.keys().map(requireContext);
}
requireAll(require.context('./components', true, /^\.\/(?!.*(?:__tests__)).*\.(jsx?)$/));
сам index.js находится в самом низу body
если добавить вызов после функции
function testfunc(){
alert('hello');
}
testfunc();
то она работает