Replies: 3 comments 1 reply
-
Hi, thanks for creating this. Project structure Flattening /components folder Context usage TypeScript? |
Beta Was this translation helpful? Give feedback.
-
Hi, MonorepoI am 100% for the monorepo setup. @MaceM8 u speak about future features regarding the "component" folder. I say that these future features deserve its own package.
Components
Babel
CodereviewI took quick look on the code it self. Nice job overall! Misc
https://github.com/lundegaard/react-mapy-cz/blob/develop/src/components/MapProvider.js
https://github.com/lundegaard/react-mapy-cz/blob/develop/src/components/Marker.js
https://github.com/lundegaard/react-mapy-cz/blob/develop/src/components/MarkerLayer.js
https://github.com/lundegaard/react-mapy-cz/blob/develop/src/components/MultipleMarkers.jsProbably good optimisation would be check what exactly changed int markersData instead od reacreating the group everytime the REFERENCE to array change. https://github.com/lundegaard/react-mapy-cz/blob/develop/src/components/Signals.js
https://github.com/lundegaard/react-mapy-cz/blob/develop/src/components/Clusterer.js
const Clusterer = () => {
const { map } = useContext(MapContext);
const markerLayer = useContext(MarkerLayerContext);
const clustererRef = useRef();
useEffect(() => {
clustererRef.current = new window.SMap.Marker.Clusterer(map);
return () => {
clustererRef.current = null;
};
}, [map]);
useEffect(() => {
markerLayer.setClusterer(clusterer.current);
});
return null;
}; https://github.com/lundegaard/react-mapy-cz/blob/develop/src/components/SearchInput/SearchInput.jsWould not be better just use renderProp pattern for rendering the input? The review is not complete but I hope it will be useful. |
Beta Was this translation helpful? Give feedback.
-
Ok, I see your points. ## Monorepo Lets agree to use warn workspaces, but about lerna I'm still not sure if we need it. Releasing will be done only with the core package. ComponentsAbout the flat structure - in Lundium it is there mainly because of the script that makes es folders with components and simple package.json. Here we are using experimental webpack 5 module output, so I think we should't need scripts like we have in Lundium. Babelwebpack takes babel-loader, which uses @babel/core with basics already inside. I'm not sure if it supports unreleased features, but it works and config is minimal, so its nice :) Testing the outputted bundle and using the library will take place in very near future. CodereviewExcellent points, thank you so much for them. I have a plan to refactor and improve most of the components, since current implementation is definitely not at the level I want it to be. |
Beta Was this translation helpful? Give feedback.
-
Discussion about project structure and code constructs
As for the project structure, I would suggest to stick to our monorepo standard. I think we have it on all our opensource projects (like https://github.com/lundegaard/validarium) as it gives you an easy way for library extension. Since we will have here main repository and also documentation app I think it already applies for monorepo usage.
Also I would start a discussion about flattening the contents of /component folder.
Way of usage of react context. I have found this way (https://kentcdodds.com/blog/how-to-use-react-context-effectively) of using of react context quite neat and transparent. Would you consider adapting the code structuring?
Beta Was this translation helpful? Give feedback.
All reactions