I would like to create a dynamic width React container to contain dynamic width children.
The dynamic width React container is that, with min-width 100px and max-width 300px. It could contain many children depend on the width of each child.
eg. If it contains one child with width 120px, the width of the container should be 120px.
If the width of the first child is 300px, it could only contain this child.
If the width of the first child is 200px, and the second is 100px, it could only contain first and second children.
If the width of the first child is 200px, and the second is 50px, could it contain a new child? That depends on the width of the third child. If its width is greater than 50px, it couldn't be contained.
I use the React functional component to do it. The key point is how to measure the children's width in advance.