{"id":22889610,"url":"https://github.com/dillingham/conjoined","last_synced_at":"2025-10-16T14:26:34.444Z","repository":{"id":41456552,"uuid":"509281629","full_name":"dillingham/conjoined","owner":"dillingham","description":"ReactJS / Next.js helpers for Laravel","archived":false,"fork":false,"pushed_at":"2022-11-20T18:14:43.000Z","size":266,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-28T07:50:32.918Z","etag":null,"topics":["laravel","nextjs","react"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/conjoined","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dillingham.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-01T01:20:50.000Z","updated_at":"2023-12-23T16:13:14.000Z","dependencies_parsed_at":"2023-01-21T20:19:52.188Z","dependency_job_id":null,"html_url":"https://github.com/dillingham/conjoined","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fconjoined","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fconjoined/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fconjoined/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fconjoined/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dillingham","download_url":"https://codeload.github.com/dillingham/conjoined/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252898360,"owners_count":21821603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","nextjs","react"],"created_at":"2024-12-13T21:56:22.611Z","updated_at":"2025-10-16T14:26:29.422Z","avatar_url":"https://github.com/dillingham.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conjoined\n\nReact / NextJS Helper for Laravel Developers\n\n```\nnpm i conjoined\n```\n\n\u003e This package assumes you already have a backend API setup with Laravel and a frontend app built with Next JS. If not, checkout the official [Laravel Breeze + Next.js](https://github.com/laravel/breeze-next) repo to get started.. makes getting started a breeze..\n\n## Pages\n\nUsing this Laravel api endpoint \u0026 response for example:\n\n```php\nRoute::get('users/{user}', [UserController::class, 'show']);\n```\n```php\npublic function show(User $user)\n{\n    return [\n        'user' =\u003e $user,\n    ];\n}\n```\n\n#### Client Side Rendering\n\nCall `usePage` from `/pages/users/[user].js` and a request to `/users/1` on your backend API will take place on mount and any data returned becomes asychronous props for your component. \n\n\n```jsx\nimport { usePage } from \"conjoined\"\n\nexport default User = () =\u003e {\n    \n    const {loading, user} = usePage();\n    \n    if(loading) {\n        return \u003cp\u003eloading..\u003c/p\u003e\n    }\n\n    return (\n        \u003ch1\u003e{user.name}\u003c/h1\u003e\n    )\n}\n```\n\n#### Server Side Rendering\n\nThe api is requested when the [server renders](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props) the page and passes the response data as props. So /users/[user].js requests /users/1 automatically for you.\n\n\n```jsx\nexport { getServerSideProps } from \"conjoined\"\n\nexport default User = ({ user }) =\u003e {\n\n    return (\n        \u003ch1\u003e{user.name}\u003c/h1\u003e\n    )\n}\n```\n\n## Forms\n\nThe form hook makes native forms as simple as declaring the values and binding to inputs.\n\nHere is a full example with a detailed explanation below.\n\n```jsx\nimport { useForm, Error } from \"conjoined\"\n\nconst form = useForm({\n    name: '',\n    email: '',\n})\n\nform.success(data =\u003e {    \n    router.push(`/users/${data.id}`)\n})\n\nreturn (\n    \u003cform action=\"/users/new\" onSubmit={form.submit}\u003e\n        \u003cinput\n            name=\"name\"\n            onChange={form.bind}\n            value={form.fields.name}\n        /\u003e\n        \n        \u003cError value={form.errors.name} /\u003e\n\n        \u003cinput\n            name=\"email\"\n            onChange={form.bind}\n            value={form.fields.email}\n        /\u003e\n\n        \u003cError value={form.errors.email} /\u003e\n\n        \u003cbutton type=\"submit\"\u003e\n            Create\n        \u003c/button\u003e\n    \u003c/form\u003e  \n)\n```\n\n#### element: form\n\n\u003e `action`: is the endpoint\n\n\u003e `onSubmit`: binds submit button click\n\n#### element: input\n\n\u003e `name` tells `form.bind` the data key to set from useForm\n\n\u003e `onChange={form.bind}` binds the input event value to that name\n\n#### component: Error \n\n\u003e A component that makes conditionally rendering errors clean. \n\n\u003e Comes with default tailwind `text-red-500` but override with className\n\n#### method: form.success()\n\n\u003e Register a callback that receives the API response data.\n\n\u003e Use this to clear the form or redirect to a new destination.\n\n#### method: form.set(key, value)\n\n\u003e Manually set a specific key to a value\n\n#### method: form.reset()\n\n\u003e Clears all inputs to initial state\n\n## Contributing\n\nI added cypress to test end to end with Next.js within `/app`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillingham%2Fconjoined","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdillingham%2Fconjoined","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillingham%2Fconjoined/lists"}