Hi,
Thanks I already have a look to that project. I agree to setup a project rapidly it’s the best base I found. I am more in discovery and learning path so I started by create a project using dfx and add step by step dependencies to react Typescript etc… I follow the documentation and it works fine using index.tsx the issue is when I tried to continue and add a component. I uncomment webpack part add tsconfig.json, etc… I suspect a miss configuration on that part but I could not find it.
The code:
index.tsx
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(
<React.StrictMode>
<App name="PostIt"/>
</React.StrictMode>,
document.getElementById('app')
);
document.title="PostIt";
App.tsx
import * as React from "react";
…
class App extends React.Component<Props> {
state : State = {
postIts: {}
};
constructor(props: Props) {
super(props);
};
componentDidMount() {
console.debug('App mount...')
}
componentWillUnmount() {
console.debug('App will unmount...')
}
render() {
const { name } = this.props;
const { postIts } = this.state
return (
<React.Fragment>
<div>{name}</div>
</React.Fragment>
);
}
}
export default App;
webpack.config.js the part I uncomment:
module: {
rules: [
{
test: /\.(ts|tsx|jsx)$/,
loader: "ts-loader"
},
{
test: /\.css$/,
use: ['style-loader','css-loader']
}
]
},
dfx.json
{
"canisters": {
"dfx_PostIt": {
"main": "src/dfx_PostIt/main.mo",
"type": "motoko"
},
"www": {
"dependencies": [
"dfx_PostIt"
],
"frontend": {
"entrypoint": "src/www/public/index.tsx"
},
"source": [
"src/www/assets",
"src/www/public",
"dist/www/"
],
"type": "assets"
}
},
"defaults": {
"build": {
"packtool": ""
}
},
"dfx": "0.6.23",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
},
"version": 1
}
The structure is: