Open damquanghieu opened 2 years ago
ooooops seems we don't have a way to do that, sorry about it, but seems like a great FR for the next version
ooooops seems we don't have a way to do that, sorry about it, but seems like a great FR for the next version
Is there any way I can do it for example overriding something?
one hack way is to fork and change this line https://github.com/shunjizhan/react-folder-tree/blob/master/src/components/EditableName/EditableName.jsx#L56 so that when it sees the default name, it display what you need
something like
{ name === DEFAULT_NAME ? 'new page' : name }
something like
{ name === DEFAULT_NAME ? 'new page' : name }
Thanks so much.
This feature. I have a problem trying to set setTreeState from a data from the api in useEffect(), But my application was looping infinitely. Can you tell me the best way to set initState from the result of an api and not a sample data like testData?
My code will look like this
hello,
The same thing happens to me, if I update the data property with a state like you do, specifically when I add a folder, it gets into an infinite loop because every time I update as you do with "setTreeState" it re-identifies the event " addNode" and repeat the cycle.
Did you know how to fix it?
Thank you.
Ernesto
I fixed it using a new state
` const handle_FolderTree_onTreeStateChange = async (state: object, event: any) => {
if (stateHandlingEvent == true) {
setStateHandlingEvent(false);
}
else {
setStateHandlingEvent(true);
const result = await FolderTree_onTreeStateChange(state, event);
}
}
`
I want to change the default name when creating a new file. For example "new page" I want to use for new functionality. Thanks very much