Closed nishant-labs closed 5 years ago
Looks right to me; can you share the component code and what’s not working?
Can't share original code, however I will try to create a jfiddle
Here is jfiddle link with basic example.
I don't know why it's not working for className
as well.
Thanks.
Your className propType in the fiddle errors only when it is a string, so i assume you want !==
there; i see the same error in the other one.
@ljharb Thanks for pointing out, Got it why jfiddle was not working for className that was my mistake. I am new to jfiddle thing. However my original issue remains same and for 'session' it is still not working. updated jfiddle
Your fiddle works fine when I use the non minified prop-types file - this is because the minified one is the production build, which does not actually do anything - you need to use the non-minified one.
Team,
I was trying to create a custom prop-types for an object using shape as below. Found that prop type for the property inside the shape (
session
) is not working, however same definition forclassName
is working fine.I just copied above function to create custom validation.
Am I missing anything or its a bug!!
Thanks Nishant