score:1

you can't do that because attribute without any value means that this attribute has value true in jsx. just don't pass data-test and this.props['data-test'] will be undefined in your component. or if you need to have this attribute with empty value then just add it to your default values in component definition.

defaultprops: {
    'data-test': ''
}

score:2

if you refer to the doc on createelement api, you can insert the value to your data-test prop like this:

react.createelement('div', {classname: 'test', 'data-test': 'some value'});

Related Query