wrote my own react custom element register function