Skip to content

Commit

Permalink
correct extensions for imports - show path on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
ewansheldon committed Oct 25, 2024
1 parent 4c00c65 commit 2b9b381
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 12 deletions.
1 change: 0 additions & 1 deletion index.html

This file was deleted.

45 changes: 45 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@types/react-dom": "^18.3.1",
"gh-pages": "^6.2.0",
"html-webpack-plugin": "^5.6.3",
"react-router-dom": "^6.27.0",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.3",
Expand Down
23 changes: 13 additions & 10 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import React from "react";
import {createRoot} from "react-dom/client"
import { createRoot } from "react-dom/client";
import WalkingSkeleton from "./pages/WalkingSkeleton";

// A simple Class component
class WalkingSkeleton extends React.Component {
render() {
return <h1>ewan's walking skeleton</h1>
}
}
// const WalkingSkeleton = () => {
// return <h1>ewan's walking skeleton</h1>;
// };

// Use traditional DOM manipulation to create a root element for React
document.body.innerHTML = '<div id="app"></div>'
document.body.innerHTML = '<div id="app"></div>';

// Create a root element for React
const app = createRoot(document.getElementById("app")!)
const app = createRoot(document.getElementById("app")!);
// Render our WalkingSkeleton component
app.render(<WalkingSkeleton/>)
app.render(
<>
<p>{window.location.pathname}</p>
<WalkingSkeleton />
</>
);
5 changes: 5 additions & 0 deletions src/pages/WalkingSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const WalkingSkeleton = () => {
return <p>ewan's imported walking sheldon</p>
}

export default WalkingSkeleton;
5 changes: 4 additions & 1 deletion webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ module.exports = {
],
},
plugins: [new HtmlWebpackPlugin()],
}
resolve: {
extensions: ['.js', '.tsx'] // add your other extensions here
}
};

0 comments on commit 2b9b381

Please sign in to comment.