No, I believe that refers to my first reply, where I was referencing the FCC page on PropTypes being imported from react. But on the React Docs, it says that since 15.5, it’s now imported from proptypes like you did.
so I hit that stopping point where I can start a new thing. I made a project in vscode to test the code. It works, even with your original syntax. TL;DR: Did you check the browser console? That’s where I saw the error.
My procedure:
create-react-app proptest //make the node/react project
cd proptest //move into the root dir for the project
code . //start VSCode using the current (project) dir as the workspace
npm start // start the development server, accessible at localhost:3000
I then copy/pasted your code to ./App.js
The webpage updated with this (webpage with <h5> at left, console at right):
first,i must appologize for replying so late but i was really really super busy
second, what i normally do bro is this when i open a cra project:
cd projectName
npm start
ofcourse in your comment u created it from scratch but anyway the only difference i can see is "code . " is that what makes it work ?
No, I mean: where are you looking for the errors. I mentioned my process to show that I was doing nothing special. Can you run your app and show us a screenshot of your console like I did?
Nice bro,well done …i thought it would show me an error on the webpage like it does normally if there is something wrong with my syntax .Note:class throws an error but it is perfectly correct.you can check another post for me regarding that
The first error is what @vipatron is talking about
This is second error is relates to what I was talking to you about. PropTypes hasn’t been really updated for quite a long time (and i suspect will die completely pretty soon) — I don’t think it’s going to recognise bleeding-edge stuff around allowing class rather than className as validedit not PropTypes error, just warning as expected, I’m not massively familiar with how bleeding-edge React is dealing with class vs. className attributes - I think it should Just Work, but that you always get those warnings
edit edit aha yeah class works perfectly, but you just get nasty warnings in the console.
To ping off of what @DanCouper said: The error says (I think) that you assigned a class attribute to some html elements that look like this:
<div>
<h1 class="xyz">
</h1>
</div>
But since that structure doesn’t appear anywhere in the code you shared with us, I can’t be 100% certain. I didn’t get that error because I didn’t run that code. As for whether your css classes are being applied correctly, I can’t say for sure, but I’m pretty sure they won’t be.