-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
static/*: update render functions to react18 syntax
- Loading branch information
Showing
6 changed files
with
25 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { createRoot } from 'react-dom/client' | ||
|
||
import CommentBox from './CommentBox' | ||
|
||
module.exports.renderComment = function (el) { | ||
const props = JSON.parse(el.getAttribute('data-attributes')) | ||
ReactDOM.render(<CommentBox {...props} />, el) | ||
const root = createRoot(el) | ||
root.render(<CommentBox {...props} />) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { createRoot } from 'react-dom/client' | ||
|
||
import CommentBox from './comment_box' | ||
|
||
export function renderComment (el) { | ||
const props = JSON.parse(el.getAttribute('data-attributes')) | ||
ReactDOM.render(<CommentBox {...props} ref={(commentbox) => { window.commentbox = commentbox }} />, el) | ||
const root = createRoot(el) | ||
root.render(<CommentBox {...props} ref={(commentbox) => { window.commentbox = commentbox }} />) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { createRoot } from 'react-dom/client' | ||
|
||
import FollowButton from './FollowButton' | ||
|
||
module.exports.renderFollow = function (el) { | ||
const project = el.getAttribute('data-project') | ||
ReactDOM.render(<FollowButton project={project} />, el) | ||
const root = createRoot(el) | ||
root.render(<FollowButton project={project} />) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { createRoot } from 'react-dom/client' | ||
|
||
import { EditPollQuestions } from './EditPollQuestions' | ||
import PollQuestions from './PollQuestions' | ||
|
||
module.exports.renderPolls = function (element) { | ||
const pollId = element.getAttribute('data-poll-id') | ||
|
||
ReactDOM.render(<PollQuestions pollId={pollId} />, element) | ||
const container = element | ||
const root = createRoot(container) | ||
root.render(<PollQuestions pollId={pollId} />) | ||
} | ||
|
||
module.exports.renderPollManagement = function (element) { | ||
const pollId = JSON.parse(element.getAttribute('data-poll-id')) | ||
|
||
const reloadOnSuccess = JSON.parse(element.getAttribute('data-reloadOnSuccess')) | ||
|
||
ReactDOM.render(<EditPollQuestions pollId={pollId} reloadOnSuccess={reloadOnSuccess} />, element) | ||
const root = createRoot(element) | ||
root.render(<EditPollQuestions pollId={pollId} reloadOnSuccess={reloadOnSuccess} />) | ||
} |
This file contains 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
This file contains 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