Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the t name from the generated Go code #7

Closed
a-h opened this issue May 22, 2021 · 0 comments
Closed

Remove the t name from the generated Go code #7

a-h opened this issue May 22, 2021 · 0 comments

Comments

@a-h
Copy link
Owner

a-h commented May 22, 2021

This won't compile:

{% templ Todo(t *todo.Todo) %}
  <div>
    <div>{%= t.Item %}</div>
  </div>
{% endtempl %}

Because there's already a (t templ.Component) return variable.

func Todo(t *todo.Todo) (t templ.Component) {
	return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
		_, err = io.WriteString(w, "<div>")
		if err != nil {
   ...

There just doesn't need to be.

@a-h a-h closed this as completed in 7dc1886 May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant