对于react-admin-demo,必须完全完成react-admin的构建。 根据文档,它经过笨拙的制作过程。
有人通过npm install and run本身安装了文件夹吗?
关于如何简化和创建我自己的项目的任何提示?
参考:https://github.com/marmelab/react-admin/tree/master/examples/demo
答案 0 :(得分:2)
这是一个包含许多软件包的Mono存储库。它使用学习和纱线工作区。您必须使用constructor(props){
super(props);
let disks = [
[],
[],
[]
];
//Initially all disks in first tower
for(let i=0; i<props.numberOfDisks; i++){
disks[0].push(i);
}
this.state = {
disks : disks,
selected : null,
move: 0,
history: [disks]
};
}
handleClick(i){
const disks = this.state.disks.slice();
const history = this.state.history.slice();
let move = this.state.move;
let selected = this.state.selected;
//if user has not previously selected a tower or selects the same tower again
if(selected===null || i===selected){
selected = disks[i].length>0 && i!==selected ? i : null;
this.setState({
selected : selected
});
return;
}
//Check if move is legal
//index is at bottom is 0 and the largest disk has id 0
if(disks[i].length === 0 || disks[i][disks[i].length-1] < disks[selected][disks[selected].length-1]){
//perform move
disks[i].push(disks[selected].pop());
move++;
// I guess this is where it goes wrong, but I can't see why
this.setState({
history: history.concat([disks]),
disks: disks,
move: move
});
}
this.setState({
selected: null
});
console.log(this.state.history);
}
。
yarn
主文件中有多个脚本,可以帮助您在没有package.json
的情况下开始贡献。 make
中的每个软件包都可以通过在其文件夹中运行packages
来构建。
要在一个命令中构建所有软件包,可以在根文件夹中运行yarn build
。