diff --git a/lib/generators/react/packroot/packroot_generator.rb b/lib/generators/react/packroot/packroot_generator.rb index 0c395764..a684165a 100644 --- a/lib/generators/react/packroot/packroot_generator.rb +++ b/lib/generators/react/packroot/packroot_generator.rb @@ -3,8 +3,8 @@ module React class PackrootGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) def copy_file_to_app - template 'page.ts.erb', "javascripts/app/#{file_name.underscore}.ts" - generate 'react:component', "#{file_name.underscore}/#{file_name.underscore}" + template 'page.tsx.erb', "javascripts/app/#{file_name.underscore}.tsx" + generate 'react:component', "#{file_name.underscore}/#{file_name.camelize}" end end end diff --git a/lib/generators/react/packroot/templates/page.ts.erb b/lib/generators/react/packroot/templates/page.tsx.erb similarity index 56% rename from lib/generators/react/packroot/templates/page.ts.erb rename to lib/generators/react/packroot/templates/page.tsx.erb index b0aa175d..d8aa59c6 100644 --- a/lib/generators/react/packroot/templates/page.ts.erb +++ b/lib/generators/react/packroot/templates/page.tsx.erb @@ -1,13 +1,13 @@ // License: LGPL-3.0-or-later // require a root component here. This will be treated as the root of a webpack package import Root from "../src/components/common/Root" -import RegistrationPage from "../src/components/<%= file_name.underscore%>/<%= file_name.underscore%>" +import <%=file_name.camelize %> from "../src/components/<%= file_name.underscore%>/<%= file_name.camelize%>" import * as ReactDOM from 'react-dom' import * as React from 'react' function LoadReactPage(element:HTMLElement) { - ReactDOM.render(, element) + ReactDOM.render(<<%=file_name.camelize %>/>, element) }