Convert your set of strings to optimized RegExps at build time with babel macros.
npm install --save-dev regexgen.macro
import regexgen from 'regexgen.macro'
regexgen('children dangerouslySetInnerHTML key ref autoFocus defaultValue')
regexgen([
'children',
'dangerouslySetInnerHTML',
'key',
'ref',
'autoFocus',
'defaultValue',
])
regexgen({
children: true,
dangerouslySetInnerHTML: true,
key: true,
ref: true,
autoFocus: true,
defaultValue: true,
})