react-firebase icon indicating copy to clipboard operation
react-firebase copied to clipboard

[WIP] Add basic error handling

Open gmaclennan opened this issue 8 years ago • 2 comments

Some initial ideas to fix #43

Feedback welcome!

gmaclennan avatar Jun 22 '17 18:06 gmaclennan

This is definitely a missing feature, so thanks for taking a stabb at it.

einarlove avatar Jun 23 '17 10:06 einarlove

Tried your solution and it works, but If you don't pass a mergeProps function you won't know if you got errors or not. One solution is to make the defaultMergeProps pass errors as errors prop by default. With this approach there will always be an errors object with your keys as null.

props: {
  firstName: 'Einar',
  lastName: 'Löve',
  emoji: '👶',
  errors: {
    firstName: null,
    lastName: null,
    emoji: null,
  },
}

Not ideal.

I tried another approach where the props passed down could be an error instead. Take a look and see if it meets your needs.

einarlove avatar Jun 23 '17 12:06 einarlove