I have a find command that searches multiple file types using grep. For example, if want to search .js and .jsx files for the string foo, while excluding the dist directory, I'd type:
find . -path "./dist" -prune -or -iname "*.js" -exec grep "foo" {} + -or -iname "*.jsx" -exec grep "foo" {} +
Is there a way to rewrite this command so that the -exec isn't duplicated for each file type? I tried
find . -path "./dist" -prune -or -iname "*.js" -or -iname "*.jsx" -exec grep "foo" {} +
but all that searched just the .jsx files, not both .js and .jsx.