Pass entire file into fileTemplate#2
Open
nick-michael wants to merge 1 commit intowoodpig07:masterfrom
nick-michael:patch-1
Open
Pass entire file into fileTemplate#2nick-michael wants to merge 1 commit intowoodpig07:masterfrom nick-michael:patch-1
nick-michael wants to merge 1 commit intowoodpig07:masterfrom
nick-michael:patch-1
Conversation
Lets you use file data in other functions in the template:
e.g
```
customFile = (props) => {
return (
<a className="file-tree-item" draggable="true" onDragStart={(e) => this.handleDragStart(e, props)}><span className='file-tree-svg'
dangerouslySetInnerHTML={{__html: '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="24" height="24" viewBox="0 0 24.00 24.00" enable-background="new 0 0 24.00 24.00" xml:space="preserve">' +
'<path d="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z"></path>' +
'</svg>'}} />
{ props.name }
</a>
)
}
```
So now we pass props (which in this case is now the entire file) into the `onDragStart` handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets you use file data in other functions in the template:
e.g
So now we pass props (which in this case is now the entire file) into the
onDragStarthandler